Exemple #1
0
    def read_msg(self, message: Any) -> AcsReadMsgResult:
        if not isinstance(message, models.GetParameterValuesResponse):
            return AcsReadMsgResult(False, None)
        # Current values of the fetched parameters
        name_to_val = parse_get_parameter_values_response(
            self.acs.data_model, message)
        logging.debug('Fetched Transient Params: %s', str(name_to_val))

        # Clear stats when eNodeB stops radiating. This is
        # because eNodeB stops sending performance metrics at this point.
        prev_rf_tx = False
        if self.acs.device_cfg.has_parameter(ParameterName.RF_TX_STATUS):
            prev_rf_tx = \
                self.acs.device_cfg.get_parameter(ParameterName.RF_TX_STATUS)
        next_rf_tx = name_to_val[ParameterName.RF_TX_STATUS]
        if prev_rf_tx is True and next_rf_tx is False:
            self.acs.stats_manager.clear_stats()

        # Update device configuration
        for name in name_to_val:
            magma_val = \
                self.acs.data_model.transform_for_magma(name,
                                                        name_to_val[name])
            self.acs.device_cfg.set_parameter(name, magma_val)

        # Update status metrics
        status = get_enodeb_status(self.acs)
        update_status_metrics(status)

        return AcsReadMsgResult(True, self.get_next_state())
 def GetStatus(self, _=None, context=None):
     """
     Get eNodeB status
     Note: input variable defaults used so this can be either called locally
     or as an RPC.
     """
     state_machine = self.state_machine_pointer.state_machine
     status = get_enodeb_status(state_machine)
     status_message = ServiceStatus()
     status_message.meta.update(status)
     return status_message
Exemple #3
0
    def _check_mme_connection(self) -> None:
        """
        Check if eNodeB should be connected to MME but isn't, and maybe reboot.

        If the eNB doesn't report connection to MME within a timeout period,
        get it to reboot in the hope that it will fix things.

        Usually, enodebd polls the eNodeB for whether it is connected to MME.
        This method checks the last polled MME connection status, and if
        eNodeB should be connected to MME but it isn't.
        """
        status = get_enodeb_status(self)

        # True if we would expect MME to be connected, but it isn't
        is_mme_unexpectedly_dc = \
            self.is_enodeb_connected() \
            and self.is_enodeb_configured() \
            and self.mconfig.allow_enodeb_transmit \
            and not status['mme_connected'] == '1'

        if is_mme_unexpectedly_dc:
            logging.warning('eNodeB is connected to AGw, is configured, '
                            'and has AdminState enabled for transmit. '
                            'MME connection to eNB is missing.')
            if self.mme_timer is None:
                logging.warning('eNodeB will be rebooted if MME connection '
                                'is not established in: %s seconds.',
                                self.MME_DISCONNECT_ENODEB_REBOOT_TIMER)
                metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(1)
                self.mme_timer = \
                    StateMachineTimer(self.MME_DISCONNECT_ENODEB_REBOOT_TIMER)
            elif self.mme_timer.is_done():
                logging.warning('eNodeB has not established MME connection '
                                'within %s seconds - rebooting!',
                                self.MME_DISCONNECT_ENODEB_REBOOT_TIMER)
                metrics.STAT_ENODEB_REBOOTS.labels(cause='MME disconnect').inc()
                metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(0)
                self.mme_timer = None
                self.reboot_asap()
            else:
                # eNB is not connected to MME, but we're still waiting to see
                # if it will connect within the timeout period.
                # Take no action for now.
                pass
        else:
            if self.mme_timer is not None:
                logging.info('eNodeB has established MME connection.')
                self.mme_timer = None
            metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(0)
Exemple #4
0
    def _check_mme_connection(self) -> None:
        """
        Check if eNodeB should be connected to MME but isn't, and maybe reboot.

        If the eNB doesn't report connection to MME within a timeout period,
        get it to reboot in the hope that it will fix things.
        """
        logging.info('Checking mme connection')
        status = get_enodeb_status(self)

        reboot_disabled = \
            not self.is_enodeb_connected() \
            or not self.is_enodeb_configured() \
            or status['mme_connected'] == '1' \
            or not self.mconfig.allow_enodeb_transmit

        if reboot_disabled:
            if self.mme_timer is not None:
                logging.info('Clearing eNodeB reboot timer')
            metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(0)
            self.mme_timer = None
            return

        if self.mme_timer is None:
            logging.info('Set eNodeB reboot timer: %s',
                         self.MME_DISCONNECT_ENODEB_REBOOT_TIMER)
            metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(1)
            self.mme_timer = \
                StateMachineTimer(self.MME_DISCONNECT_ENODEB_REBOOT_TIMER)
        elif self.mme_timer.is_done():
            logging.warning('eNodeB reboot timer expired - rebooting!')
            metrics.STAT_ENODEB_REBOOTS.labels(cause='MME disconnect').inc()
            metrics.STAT_ENODEB_REBOOT_TIMER_ACTIVE.set(0)
            self.mme_timer = None
            self.reboot_asap()
        else:
            # eNB is not connected to MME, but we're still waiting to see if
            # it will connect within the timeout period.
            # Take no action for now.
            pass
Exemple #5
0
 def get_status():
     return get_enodeb_status(state_machine_pointer.state_machine)