def wait_until_attached(self, timeout=120): """ Waits until the DUT is attached to the primary carrier. Args: timeout: after this amount of time the method will raise a CellularSimulatorError exception. Default is 120 seconds. """ try: self.anritsu.wait_for_registration_state(time_to_wait=timeout) except anritsu.AnritsuError: raise cc.CellularSimulatorError('The phone did not attach before ' 'the timeout period ended.')
def wait_until_idle_state(self, timeout=120): """ Waits until the DUT is in Idle state. Args: timeout: after this amount of time the method will raise a CellularSimulatorError exception. Default is 120 seconds. """ try: self.cmw.wait_for_rrc_state(cmw500.LTE_IDLE_RESP, timeout=timeout) except cmw500.CmwError: raise cc.CellularSimulatorError('The phone was not in ' 'Idle state before ' 'the timeout period ended.')
def wait_until_attached(self, timeout=120): """ Waits until the DUT is attached to the primary carrier. Args: timeout: after this amount of time the method will raise a CellularSimulatorError exception. Default is 120 seconds. """ try: self.cmw.wait_for_attached_state(timeout=timeout) except cmw500.CmwError: raise cc.CellularSimulatorError('The phone was not in ' 'attached state before ' 'the timeout period ended.')
def __init__(self, ip_address, port): """ Initializes the cellular simulator. Args: ip_address: the ip address of the CMX500 port: the port number for the CMX500 controller """ super().__init__() try: self.cmx = cmx500.Cmx500(ip_address, port) except cmx500.CmxError: raise cc.CellularSimulatorError('Could not connect to CMX500.')
def wait_until_idle_state(self, timeout=120): """ Waits until the DUT is in Idle state. Args: timeout: after this amount of time the method will raise a CellularSimulatorError exception. Default is 120 seconds. """ try: self.anritsu.wait_for_idle_state(time_to_wait=timeout) except anritsu.AnritsuError: raise cc.CellularSimulatorError('The phone was not in Idle state ' 'before the time the timeout ' 'period ended.')
def __init__(self, ip_address): """ Initializes the cellular simulator. Args: ip_address: the ip address of the MD8475 instrument """ super().__init__() try: self.anritsu = md8475a.MD8475A(ip_address, md8475_version=self.MD8475_VERSION) except anritsu.AnritsuError: raise cc.CellularSimulatorError('Could not connect to MD8475.') self.bts = None
def __init__(self, ip_address, port): """ Initializes the cellular simulator. Args: ip_address: the ip address of the CMW500 port: the port number for the CMW500 controller """ super().__init__() try: self.cmw = cmw500.Cmw500(ip_address, port) except cmw500.CmwError: raise cc.CellularSimulatorError('Could not connect to CMW500.') self.bts = None self.dl_modulation = None self.ul_modulation = None
def get_measured_pusch_power(self): """ Queries PUSCH power measured at the callbox. Returns: The PUSCH power in the primary input port. """ # Try three times before raising an exception. This is needed because # the callbox sometimes reports an active chain as 'DEACTIVE'. retries_left = 3 while retries_left > 0: ul_pusch = self.anritsu.get_measured_pusch_power().split(',')[0] if ul_pusch != 'DEACTIVE': return float(ul_pusch) time.sleep(3) retries_left -= 1 self.log.info('Chain shows as inactive. %d retries left.' % retries_left) raise cc.CellularSimulatorError('Could not get measured PUSCH power.')
def set_ca_combination(self, combination): """ Prepares the test equipment for the indicated CA combination. The reason why this is implemented in a separate method and not calling LteSimulation.BtsConfig for each separate band is that configuring each ssc cannot be done separately, as it is necessary to know which carriers are on the same band in order to decide which RF outputs can be shared in the test equipment. Args: combination: carrier aggregation configurations are indicated with a list of strings consisting of the band number followed by the CA class. For example, for 5 CA using 3C 7C and 28A the parameter value should be [3c, 7c, 28a]. """ # Obtain the list of bands from the carrier combination list bands = [] for ca in combination: ca_class = ca[-1] band = ca[:-1] # If the band appears twice in the combo it means that carriers # must be in the same band but non contiguous. if band in bands: raise cc.CellularSimulatorError( 'Intra-band non-contiguous carrier aggregation is not ' 'supported.') if ca_class.upper() == 'B': raise cc.CellularSimulatorError( 'Class B carrier aggregation is not supported') elif ca_class.upper() == 'A': bands.append(band) elif ca_class.upper() == 'C': # Class C means two contiguous carriers in the same band, so # add the band twice to the list. bands.append(band) bands.append(band) else: raise cc.CellularSimulatorError('Invalid carrier aggregation ' 'configuration: ' + ca) self.num_carriers = len(bands) # Validate the number of carriers. if self.num_carriers > self.LTE_MAX_CARRIERS: raise cc.CellularSimulatorError('The test equipment supports up ' 'to {} carriers.'.format( self.LTE_MAX_CARRIERS)) elif self.num_carriers < 2: raise cc.CellularSimulatorError('At least two carriers need to be ' 'indicated for the carrier ' 'aggregation simulation.') # Initialize the base stations in the test equipment self.anritsu.set_simulation_model( *[md8475a.BtsTechnology.LTE for _ in range(self.num_carriers)], reset=False) # If base stations use different bands, make sure that the RF cards are # not being shared by setting the right maximum MIMO modes if self.num_carriers == 2: # RF cards are never shared when doing 2CA so 4X4 can be done in # both base stations. self.bts[0].mimo_support = md8475a.LteMimoMode.MIMO_4X4 self.bts[1].mimo_support = md8475a.LteMimoMode.MIMO_4X4 if self.num_carriers == 3: # 4X4 can only be done in the second base station if it is shared # with the primary. If the RF cards cannot be shared, then at most # 2X2 can be done. self.bts[0].mimo_support = md8475a.LteMimoMode.MIMO_4X4 if bands[0] == bands[1]: self.bts[1].mimo_support = md8475a.LteMimoMode.MIMO_4X4 else: self.bts[1].mimo_support = md8475a.LteMimoMode.MIMO_2X2 self.bts[2].mimo_support = md8475a.LteMimoMode.MIMO_2X2 # Enable carrier aggregation self.anritsu.set_carrier_aggregation_enabled() # Restart the simulation as changing the simulation model will stop it. self.anritsu.start_simulation() # Set the bands in each base station for bts_index in range(len(bands)): self.set_band(bts_index, bands[bts_index])