def __init__(self, tc_name, global_config): """ Constructor """ LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Get LTE server parameters for ping self._server = \ global_config.benchConfig.get_parameters("LAB_LTE_SERVER") self._server_ip_address = self._server.get_param_value("IP") self._username = self._server.get_param_value("username") self._password = self._server.get_param_value("password") # Read the number of pings to do self._nb_pings = self._tc_parameters.get_param_value("PACKET_COUNT") # Read the data size of a packet self._packet_size = self._tc_parameters.get_param_value("PACKET_SIZE") # Get target % of received packet for ping self._target_ping_packet_loss_rate = \ float(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) # init wanted registration parameters to a value that self._wanted_reg_state = "None" self._ns_lte_cell_service = "None"
def __init__(self, tc_name, global_config): """ Constructor """ LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Get LTE server parameters for ping self._server = \ global_config.benchConfig.get_parameters("LAB_LTE_SERVER") self._server_ip_address = self._server.get_param_value("IP") self._username = self._server.get_param_value("username") self._password = self._server.get_param_value("password") # Read GSM from testcase xml parameters self._back_and_forth = \ str_to_bool(self._tc_parameters.get_param_value("BACK_AND_FORTH", "FALSE")) # Read CRESEL_LIMIT_POWER from testcase xml parameters self._cresel_limit_power = \ float(self._tc_parameters.get_param_value("CRESEL_LIMIT_POWER")) # Read CRESEL_POWER from testcase xml parameters self._cresel_power = \ float(self._tc_parameters.get_param_value("CRESEL_POWER")) # Read DECREMENTATION_STEP_POWER from testcase xml parameters self._decrementation_step_power = \ int(self._tc_parameters.get_param_value("DECREMENTATION_STEP_POWER")) # Read DECREMENTATION_STEP_TIMER from testcase xml parameters self._decrementation_step_timer = \ int(self._tc_parameters.get_param_value("DECREMENTATION_STEP_TIMER")) # Read the number of pings to do self._nb_pings = self._tc_parameters.get_param_value("PACKET_COUNT") # Read the data size of a packet self._packet_size = self._tc_parameters.get_param_value("PACKET_SIZE") # Get target % of received packet for ping self._target_ping_packet_loss_rate = \ float(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) # Read SMS_TEXT from testcase xml file self._sms_text = self._tc_parameters.get_param_value( "SMS_TEXT", "aaaabbbbbcccc") # Read PHONE_NUMBER from testcase xml parameters self._phone_number = \ str(self._tc_parameters.get_param_value("PHONE_NUMBER", "0675529935")) if self._phone_number.upper() == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) # Instantiate Messaging UECmd for SMS UseCases self._messaging_api = self._device.get_uecmd("SmsMessaging") # init wanted registration parameters to a value that self._wanted_reg_state = "None" self._ns_lte_cell_service = "None" self._ns_neighbour_power = self._ns_3gsm_cell_power self._ns_camped_power = self._ns_lte_cell_power_rf1
def set_up(self): """ Set up the test configuration """ if self._target_ping_packet_loss_rate in ("", None): self._target_ping_packet_loss_rate = float(0) else: self._target_ping_packet_loss_rate = float( self._target_ping_packet_loss_rate) emergency_numbers_string = self._device.get_property_value( LabMobilityLteEmergencyCsfb.EMERGENCY_NUMBER_PROPERTY_NAME) # Split the str to a list emergency_numbers = emergency_numbers_string.split(",") # Make sure the provided Phone Number parameter is not present # in the list of emergency numbers if self._phone_number in emergency_numbers: # Otherwise create an error message message = "Provided parameter PHONE_NUMBER [%s] as a value " \ "that corresponds to a real emergency number on the LIVE " \ "network [list: (%s)]. The test will not be executed." % ( self._phone_number, emergency_numbers_string) # Raise an exception raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, message) # Store the list of emergency numbers so that we can # restore it later self._initial_emergency_numbers = emergency_numbers_string UECmdTypes.EMERGENCY_NUMBERS_LIST = \ self._initial_ue_command_em_number + (self._phone_number,) # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) self._ns_3gsm_cell.set_mnc(LabMobilityLteEmergencyCsfb.BOUYGUES_MNC) self._ns_3gsm_cell.set_mcc(LabMobilityLteEmergencyCsfb.BOUYGUES_MCC) # Setting the IMSI attach reject cause to: PLMN Not Allowed. self._ns_3gsm_cell.set_lau_reject_gmm_cause(11) self._ns_3gsm_cell.set_lau_reject_state("ON") self._ns_3gsm_cell.set_network_mode_of_operation(2) # Wait 30 sec self._logger.info("Wait 30 seconds before powering on LTE cell to" " ensure DUT is unregistered") self._modem_api.check_cdk_no_registration_bfor_timeout(30)
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # MO or MT SMS instance self._sms.configure_sms() # Disable flight mode self._networking_api.set_flight_mode("off") # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # Set the APN time.sleep(self._wait_btwn_cmd) self._logger.info("Setting APN " + str(self._apn) + "...") self._networking_api.set_apn(self._ssid, self._apn) # Activate PDP context time.sleep(self._wait_btwn_cmd) self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid, check=False) # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=False, cell_id=self._ns_lte_cell_id) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_lte_data.get_network_type(), self._registration_timeout) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set External EPC connection between Network Simulators self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Read PHONE_NUMBER from testcase xml parameters self._phone_number = \ str(self._tc_parameters.get_param_value("PHONE_NUMBER")) if self._phone_number.upper() == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) # Read SMS_TEXT from testcase xml file self._sms_text = self._tc_parameters.get_param_value("SMS_TEXT") # Read SMS_DIRECTION from testcase xml file self._sms_direction = str( self._tc_parameters.get_param_value("SMS_DIRECTION")) # Read SMS_TRANSFER_TIMOUT from testcase xml file self._sms_transfer_timeout = \ int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT")) # Read DATA_CODING_SCHEME from xml UseCase parameter file self._data_coding_sheme = \ self._tc_parameters.get_param_value("DATA_CODING_SCHEME") dcs = DataCodingScheme(self._data_coding_sheme) dcs.decode() # Get number of bits per character setted in DCS self._nb_bits_per_char = dcs.compute_character_size() character_set = dcs.get_character_set() if character_set == "7BITS": self._content_type = "CTEX" else: self._content_type = "CDAT" # Instantiate Messaging UECmd for SMS UseCases self._messaging_api = self._device.get_uecmd("SmsMessaging") self._sms = SmsMessage(self._sms_text, self._phone_number, "LCSD", self._ns_3gsm_messaging, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, self._sms_direction)
def __init__(self, tc_name, global_config): """ Constructor """ LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Get LTE server parameters for ping self._server = \ global_config.benchConfig.get_parameters("LAB_LTE_SERVER") self._server_ip_address = self._server.get_param_value("IP") self._username = self._server.get_param_value("username") self._password = self._server.get_param_value("password") # Read GSM from testcase xml parameters self._back_and_forth = \ str_to_bool(self._tc_parameters.get_param_value("BACK_AND_FORTH", "FALSE")) # Read CRESEL_LIMIT_POWER from testcase xml parameters self._cresel_limit_power = \ float(self._tc_parameters.get_param_value("CRESEL_LIMIT_POWER")) # Read CRESEL_POWER from testcase xml parameters self._cresel_power = \ float(self._tc_parameters.get_param_value("CRESEL_POWER")) # Read DECREMENTATION_STEP_POWER from testcase xml parameters self._decrementation_step_power = \ int(self._tc_parameters.get_param_value("DECREMENTATION_STEP_POWER")) # Read DECREMENTATION_STEP_TIMER from testcase xml parameters self._decrementation_step_timer = \ int(self._tc_parameters.get_param_value("DECREMENTATION_STEP_TIMER")) # Read the number of pings to do self._nb_pings = self._tc_parameters.get_param_value("PACKET_COUNT") # Read the data size of a packet self._packet_size = self._tc_parameters.get_param_value("PACKET_SIZE") # Get target % of received packet for ping self._target_ping_packet_loss_rate = \ float(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) # init wanted registration parameters to a value that self._wanted_reg_state = "None" self._ns_lte_cell_service = "None" self._ns_neighbour_power = self._ns_lte_cell_power_rf1 self._ns_camped_power = self._ns_3gsm_cell_power
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) if self._ns_3gsm_cell_service == "GSM": # Enable message queuing self._ns_3gsm_messaging.set_sms_message_queuing_state("ON") # MO SMS instance self.sms = SmsMessage(self._sms_text, self._phone_number, "GSM") # Flight mode deactivation self._networking_api.set_flight_mode("off") # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set entries in the equivalent PLMN list self._ns_3gsm_cell.set_equivalent_plmn_list_points( self._ns_lte_mcc, self._ns_lte_mnc) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # Set parameters to go from cell 1 to cell 2 self._1_to_2_cell_parms = (self._ns_lte_cell, self._ns_3gsm_cell, self._ns_3gsm_data, self._ns_3gsm_cell_service, self._cresel_power, self._ns2_model, self._cresel_timeout, self._cresel_nocoverage_time) # Set parameters to go from cell 2 to cell 1 self._2_to_1_cell_parms = (self._ns_3gsm_cell, self._ns_lte_cell, self._ns_lte_data, self._ns_lte_cell_service, self._cresel_power, self._ns1_model, self._cresel_timeout, self._cresel_nocoverage_time) return Global.SUCCESS, "No errors"
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) if self._ns_3gsm_cell_service == "GSM": # Enable message queuing self._ns_3gsm_messaging.set_sms_message_queuing_state("ON") # MO SMS instance self.sms = SmsMessage(self._sms_text, self._phone_number, "GSM") # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set entries in the equivalent PLMN list self._ns_3gsm_cell.set_equivalent_plmn_list_points( self._ns_lte_mcc, self._ns_lte_mnc) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # Disable flight mode self._networking_api.set_flight_mode("off") # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # Set the APN time.sleep(self._wait_btwn_cmd) self._logger.info("Setting APN " + str(self._apn) + "...") self._networking_api.set_apn(self._ssid, self._apn) # Activate PDP context time.sleep(self._wait_btwn_cmd) self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid, check=False) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Clear old SMS on phone self._messaging_api.delete_all_sms() # Clear old SMS on Network Simulator self._ns_3gsm_messaging.clear_message_data() self._sms.send_sms() self._sms.get_sms() return Global.SUCCESS, "No errors"
def tear_down(self): """ Finishing the test. Stopping the FTP service and releasing the equipment. """ # Stopping the FTP service before releasing the equipment. self._ns_lte_data.stop_ftp_service() # Disconnect from external EPC self._ns_3gsm.disconnect_from_external_epc() if self._ns_3gsm_cell_tech == "3G": # Sets RAU FOP on 3G cell to auto: # FOProceed:CONTrol:AUTO 1 # FOProceed:MANual 0 self._ns_3gsm_cell.set_rau_fop_control(1, 0) # Reset the stay on setting if plugged self._phone_system.set_stay_on_while_plugged_in(0) # Set the initial screen off timeout self._phone_system.set_screen_timeout(60) # If 2 EPS bearers were requested if self._two_eps_bearers == True: #Stop AT Proxy self._logger.info("Stop AT Proxy") self._modem_flashing_api.stop_at_proxy_from_mos() #Close the serial connection self._logger.info("Close the serial connection") self._logger.info("Disconnecting from the port " + str(self._serial_handler.get_port())) self._serial_handler.disconnect() LabMobilityLte3gsmBase.tear_down(self) return Global.SUCCESS, "No errors"
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set entries in the equivalent PLMN list self._ns_3gsm_cell.set_equivalent_plmn_list_points( self._ns_lte_mcc, self._ns_lte_mnc) # Disconnect from external EPC self._ns_3gsm.disconnect_from_external_epc() # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Set Network Simulator 3GSM cell off self._ns_3gsm_cell.set_cell_off() # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._logger.info("Check network registration status is %s on DUT" % self._wanted_reg_state) self._modem_api.check_cdk_state_bfor_timeout( self._wanted_reg_state, self._registration_timeout) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_lte_data.get_network_type(), self._registration_timeout) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Disconnect from external EPC self._ns_3gsm.disconnect_from_external_epc() # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # Wait 5 seconds time.sleep(5) # Set primary cell to first cell self._cell_in_use = 1 cell_parms = self._1_to_2_cell_parms self._logger.info("Go out of coverage then switch to cell %d", self._cell_in_use) self.go_out_of_coverage_and_cresel(*cell_parms) self._logger.info("End out of coverage procedure") # Case LTE to GSM # if the reselection is performed to GSM cell, send an MO SMS if self._ns_3gsm_cell_service == "GSM": # Send MO SMS self._messaging_api.send_sms(self.sms.sender, self.sms.message) # Check the MO SMS received On Network Simulator (result_verdict, result_message) = \ self._ns_3gsm_messaging.check_sms_delivery_state(self.sms, 1, self._registration_timeout) # Test LTE to GSM cell reselection is finished return result_verdict, result_message # Case LTE to EGPRS or UTRA else: # Activate PDP context self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid) # Check Data Connection State => PDP Active before timeout if (self._ns_3gsm_data.check_data_connection_state( "PDP_ACTIVE", self._registration_timeout)) == False: #PDP not activated in time, return error message = "Exit - PDP NOT activated" self._logger.error(message) return Global.FAILURE, message # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after cell reselection failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell reselection is done" # ------------------------------------------------------------------- # if we want to do a return cell reselection (go back) if self._back_and_forth: message = "---- BACK and FORTH ---- Going from 3G cell to 4G cell" self._logger.info(message) # Set primary cell to first cell if self._cell_in_use == 1: self._cell_in_use = 2 cell_parms = self._2_to_1_cell_parms self._logger.info("Go out of coverage then switch to cell %d", self._cell_in_use) self.go_out_of_coverage_and_cresel(*cell_parms) self._logger.info("End out of coverage procedure") # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) self._logger.info("wait 10 sec after registering on LTE Cell") time.sleep(10) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after second cell reselection failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell reselection is done" return result_verdict, result_message
def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Check Data Connection State => CON before timeout self._ns_3gsm_data.check_data_connection_state( "PDP_ACTIVE", self._registration_timeout, blocking=True) # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._logger.info("Check network registration status is %s on DUT" % self._wanted_reg_state) self._modem_api.check_cdk_state_bfor_timeout( self._wanted_reg_state, self._registration_timeout) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_3gsm_data.get_network_type(), self._registration_timeout) if self._ns_3gsm_cell_tech == "3G": # transition the DUT to RRC_Idle if the UE is on a PDP Context in CELL_DCH or CELL_FACH state self._ns_3gsm_cell.set_rrc_state_transition("IDLE") # set the resel power self._ns_lte_cell.set_cell_power(self._cresel_power) msg = "Begin to decrease Camped cell power from %.2f dBm " msg += "to %.2f dBm each %d seconds by step of %.2f dBm while " msg += "cell reselection isn't performed." self._logger.info(msg, self._ns_camped_power, self._cresel_limit_power, self._decrementation_step_timer, self._decrementation_step_power) # Decrease cell power on 3GSM and wait for DUT to be camped on LTE # and log the result in msg msg = self.decrease_cell_power_while_idle( self._ns_3gsm_cell, self._ns_camped_power, self._ns_lte_cell, self._ns_lte_data, self._ns_lte_cell_service, self._decrementation_step_power, self._decrementation_step_timer, self._cresel_limit_power, self._cresel_power, self._ns1_model) self._ns_neighbour_power = self._cresel_limit_power self._ns_camped_power = self._cresel_power # Display Cell reselection result self._logger.info(msg) # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) # Display Cell reselection result self._logger.info(msg) self._logger.info("wait 10 sec after registering on LTE Cell") time.sleep(10) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell reselection is done" # if we want to do a return cell reselection (go back) if self._back_and_forth: msg = "Begin to decrease Camped cell power from %.2f dBm " msg += "to %.2f dBm each %d seconds by step of %.2f dBm while " msg += "cell reselection isn't performed." self._logger.info(msg, self._ns_camped_power, self._cresel_limit_power, self._decrementation_step_timer, self._decrementation_step_power) # Decrease cell power on NS1 and wait for DUT to be camped on NS2 # and log the result in msg msg = self.decrease_cell_power_while_idle( self._ns_lte_cell, self._ns_camped_power, self._ns_3gsm_cell, self._ns_3gsm_data, self._ns_3gsm_cell_service, self._decrementation_step_power, self._decrementation_step_timer, self._cresel_limit_power, self._cresel_power, self._ns2_model) self._ns_neighbour_power = self._cresel_limit_power self._ns_camped_power = self._cresel_power # Display Cell reselection result self._logger.info(msg) # Check Data Connection State => CON before timeout self._ns_3gsm_data.check_data_connection_state( "ATTACHED", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) self._logger.info("wait 10 sec after registering on 3GSM Cell") time.sleep(10) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after cell reselection failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS result_message = "cell reselection is done" message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) return result_verdict, result_message
def set_up(self): """ Initialize the test """ # Stay on if plugged self._phone_system.set_stay_on_while_plugged_in(3) # Remove screen off timeout self._phone_system.set_screen_timeout(3600) # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) # Flight mode activation self._networking_api.set_flight_mode("on") # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set the same DUT IP address also for Agilent self._ns_3gsm_data.set_dut_ip_address(1, self._ns1_ip_dut) if self._two_eps_bearers is True: # Configure secondary PDP/EPS bearer on the NW simulators self._ns_lte.stop_scenario() self._configure_for_second_pdp() self._ns_lte.start_scenario() time.sleep(self._wait_btwn_cmd) if self._ns_3gsm_cell_tech == "3G": # Sets RAU FOP on 3G cell to manual: # FOProceed:CONTrol:AUTO 0 # FOProceed:MANual 1 self._ns_3gsm_cell.set_rau_fop_control(0, 1) time.sleep(self._wait_btwn_cmd) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # Set LTE Cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set cell power to -115 dBm self._ns_3gsm_cell.set_cell_power(-115) # Flight mode deactivation self._networking_api.set_flight_mode("off") # Check registration state is connected using # registrationTimeout from Device_Catalog.xml (Non blocking # for this test if function isn't implemented on CDK) self._modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # Activate PDP context time.sleep(self._wait_btwn_cmd) self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid, False) # Check data connection state is "CON" self._ns_lte_data.check_data_connection_state( "CON", self._camp_timeout, blocking=False, cell_id=self._ns_lte_cell_id) # Get RAT from Equipment network_type = self._ns_lte_data.get_network_type() # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( network_type, self._registration_timeout) # Wait 10 seconds time.sleep(10) if self._irat_type == "NORMAL": # Set cell power to -70 dBm self._ns_3gsm_cell.set_cell_power(-70) # Start FTP service on equipment side self._ns_lte_data.start_ftp_service() # Selecting the IPV6 address of the FTP server, according to # the TC parameter value. if self._ip_version == "IPV6": if self._server_ip_v6_address is not None: # If Protocol is IPV6 use IPV6 address. log_msg = "Using IPV6 address to connect to the FTP server." self._logger.info(log_msg) self._ip_address = self._server_ip_v6_address else: # If IPV6 address is not present in the BenchConfig. msg = "The IPV6 parameter is missing from the Bench Config!" raise AcsConfigException( AcsConfigException.INVALID_BENCH_CONFIG, msg) else: self._ip_address = self._server_ip_address return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ # Call LabMobilityLte3gsmBase Init function LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Get FTP server parameters self._server = \ global_config.benchConfig.get_parameters("LAB_LTE_SERVER") self._server_ip_address = self._server.get_param_value("IP") self._username = self._server.get_param_value("username") self._password = self._server.get_param_value("password") if self._server.has_parameter("ftp_path"): self._ftp_path = self._server.get_param_value("ftp_path") else: self._ftp_path = "" # Define PING parameters self._packet_size = 32 self._nb_pings = 10 # Read the the direction file name from UseCase xml Parameter self._direction = self._tc_parameters.get_param_value("DIRECTION") # Checking if the entered direction is correct. if self._direction not in ("UL", "DL", "BOTH"): self._error.Msg = "%s is not a known xfer direction" % \ self._direction raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, self._error.Msg) # Read the ftp file name from UseCase xml Parameter if self._direction == "DL": self._ftp_filename = os.path.join( self._ftp_path, self._tc_parameters.get_param_value("DL_FILENAME")) self._ftp_filename = self._ftp_filename.replace('\\', '/') elif self._direction == "UL": # Read the UL_FILE value from UseCase xml Parameter// self._ftp_filename = os.path.join( self._ftp_path, self._tc_parameters.get_param_value("UL_FILENAME")) self._ftp_filename = self._ftp_filename.replace('\\', '/') elif self._direction == "BOTH": self._dl_ftp_filename = os.path.join( self._ftp_path, self._tc_parameters.get_param_value("DL_FILENAME")) self._dl_ftp_filename = self._dl_ftp_filename.replace('\\', '/') # Read the UL_FILE value from UseCase xml Parameter self._ul_ftp_filename = os.path.join( self._ftp_path, self._tc_parameters.get_param_value("UL_FILENAME")) self._ul_ftp_filename = self._ul_ftp_filename.replace('\\', '/') # Read CH_BANDWIDTH from test case xml file self._bandwidth = \ self._tc_parameters.get_param_value("CELL_CHANNEL_BANDWIDTH", "20") # Read ANTENNAS NUMBER from test case xml file self._antennas_number = \ self._tc_parameters.get_param_value("ANTENNAS_NUMBER", '1') # Read TRANSMISSION_MODE from test case xml file self._transmission_mode = \ self._tc_parameters.get_param_value("TRANSMISSION_MODE","TM1") # Read BANDWIDTH from test case xml file self._type0_bitmap = \ str(self._tc_parameters.get_param_value("TYPE0_BITMAP","63")) # Read DL_RB_SIZE from test case xml file self._dl_nb_rb = \ self._tc_parameters.get_param_value("DL_RB_SIZE","50") # Read UL_RB_SIZE from test case xml file self._ul_nb_rb = \ self._tc_parameters.get_param_value("UL_RB_SIZE","10") # Read I_MCS from test case xml file self._dl_i_mcs = \ self._tc_parameters.get_param_value("DL_I_MCS","23") # Read I_MCS from test case xml file self._ul_i_mcs = \ self._tc_parameters.get_param_value("UL_I_MCS","3") # Read UL Grant Mode from test case xml file self._ul_grant_mode = \ self._tc_parameters.get_param_value("UL_GRANT_MODE", "FIXEDMAC") # Read the the ip _version file name from UseCase xml Parameter self._ip_version = self._tc_parameters.get_param_value( "IP_VERSION", "IPV4") # Get the server ipv6 address from the BenchConfig, if the key # is present in the file. if self._server.has_parameter("IPV6"): self._server_ip_v6_address = self._server.get_param_value("IPV6") # Read the XFER_TIMEOUT from UseCase xml Parameter self._xfer_timeout = self._tc_parameters.get_param_value( "XFER_TIMEOUT") if self._xfer_timeout is not None and str( self._xfer_timeout).isdigit(): self._xfer_timeout = int(self._xfer_timeout) else: self._xfer_timeout = None if self._xfer_timeout is None: raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, "XFER_TIMEOUT should be int") self._two_eps_bearers = self._tc_parameters.get_param_value( "TWO_EPS_BEARER") self._two_eps_bearers = \ str_to_bool(self._two_eps_bearers) # In case of 2 PDPs, define the APN and IP address for the 2nd one if self._two_eps_bearers is True: self._second_apn = "agilent2" self._second_dut_ip_version = "IPV4" self._second_dut_ip_address = "10.102.243.25" # Read Inter-Rat redirection type self._irat_type = self._tc_parameters.get_param_value("I-RAT_TYPE") if self._irat_type is None: self._irat_type = "NORMAL" elif self._irat_type not in ("NORMAL", "BLIND"): raise AcsConfigException( AcsConfigException.INVALID_PARAMETER, "I-RAT_TYP should be 'NORMAL' or 'BLIND'") # Default timeout for DUT camping self._camp_timeout = 180 # Define timeout for AT command self._command_timeout = 10 # Define AT PROXY launch mode self._launch_mode = 2 # Initializing the variable which will contain the IP address to use. self._ip_address = None self._phone_system = self._device.get_uecmd("PhoneSystem") # if 2 EPS bearers were requested if self._two_eps_bearers == True: # Instantiate the modem UE commands self._modem_flashing_api = self._device.get_uecmd("ModemFlashing") # Get Serial Handler instance self._serial_handler = SerialHandler() # Win COM port to be used self.at_proxy_com_port = None # Store the AT proxy connection availability self.modem_available = False
def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Set Network Simulator 3GSM cell off self._ns_3gsm_cell.set_cell_off() # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._logger.info("Check network registration status is %s on DUT" % self._wanted_reg_state) self._modem_api.check_cdk_state_bfor_timeout( self._wanted_reg_state, self._registration_timeout) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_lte_data.get_network_type(), self._registration_timeout) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Disconnect from external EPC self._ns_3gsm.disconnect_from_external_epc() # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) msg = "Begin to decrease Camped cell power from %.2f dBm " msg += "to %.2f dBm each %d seconds by step of %.2f dBm while " msg += "cell reselection isn't performed." self._logger.info(msg, self._ns_camped_power, self._cresel_limit_power, self._decrementation_step_timer, self._decrementation_step_power) # Decrease cell power on NS1 and wait for DUT to be camped on NS2 # and log the result in msg msg = self.decrease_cell_power_while_idle( self._ns_lte_cell, self._ns_camped_power, self._ns_3gsm_cell, self._ns_3gsm_data, self._ns_3gsm_cell_service, self._decrementation_step_power, self._decrementation_step_timer, self._cresel_limit_power, self._cresel_power, self._ns2_model) self._ns_neighbour_power = self._cresel_limit_power self._ns_camped_power = self._cresel_power # Display Cell reselection result self._logger.info(msg) # Case LTE to GSM # if the reselection is performed to GSM cell, send an MO SMS if self._ns_3gsm_cell_service == "GSM": # Send MO SMS self._messaging_api.send_sms(self.sms.sender, self.sms.message) # Check the MO SMS received On Network Simulator (result_verdict, result_message) = \ self._ns_3gsm_messaging.check_sms_delivery_state(self.sms, 1, self._registration_timeout) # Test LTE to GSM cell reselection is finished return result_verdict, result_message # Case LTE to EGPRS or UTRA else: # Activate PDP context self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid) # Check Data Connection State => PDP Active before timeout self._ns_3gsm_data.check_data_connection_state( "PDP_ACTIVE", self._registration_timeout) self._logger.info("wait 10 sec after PDP activation") time.sleep(10) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after cell reselection failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell reselection is done" # if we want to do a return cell reselection (go back) if self._back_and_forth: msg = "Begin to decrease Camped cell power from %.2f dBm " msg += "to %.2f dBm each %d seconds by step of %.2f dBm while " msg += "cell reselection isn't performed." self._logger.info(msg, self._ns_camped_power, self._cresel_limit_power, self._decrementation_step_timer, self._decrementation_step_power) if self._ns_3gsm_cell_tech == "3G": if self._ns_3gsm_data.get_rrc_states() not in "IDLE": self._logger.info( "RRC state is %s , in order to be able to do cell reselection DUT must be in IDLE state" % self._ns_3gsm_data.get_rrc_states()) # Make sure that RRC state is IDLE in order to perform cell reselection self._ns_3gsm_cell.set_rrc_state_transition("IDLE") # Decrease cell power on 3GSM and wait for DUT to be camped on LTE # and log the result in msg msg = self.decrease_cell_power_while_idle( self._ns_3gsm_cell, self._ns_camped_power, self._ns_lte_cell, self._ns_lte_data, self._ns_lte_cell_service, self._decrementation_step_power, self._decrementation_step_timer, self._cresel_limit_power, self._cresel_power, self._ns1_model) self._ns_neighbour_power = self._cresel_limit_power self._ns_camped_power = self._cresel_power # Display Cell reselection result self._logger.info(msg) # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) self._logger.info("wait 10 sec after registering on LTE Cell") time.sleep(10) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after second cell reselection failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell reselection is done" return result_verdict, result_message
def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Disable flight mode self._networking_api.set_flight_mode("off") # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # Set the APN time.sleep(self._wait_btwn_cmd) self._logger.info("Setting APN " + str(self._apn) + "...") self._networking_api.set_apn(self._ssid, self._apn) # Activate PDP context time.sleep(self._wait_btwn_cmd) self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid, check=False) # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=True, cell_id=self._ns_lte_cell_id) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_lte_data.get_network_type(), self._registration_timeout) # in all other cell reselection cases a ping is performed packet_loss = self._networking_api.ping(self._server_ip_address, self._packet_size, self._nb_pings) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: result_verdict = Global.FAILURE message = "Ping after cell camp failed & Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) return (result_verdict, message) else: result_verdict = Global.SUCCESS message = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) self._logger.info(message) result_message = "cell camp is done" return result_verdict, result_message