mobile_insight.analyzer.kpi package

Submodules

Module contents

class mobile_insight.analyzer.kpi.AttachSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage RRC connection success rate

__calculate_kpi()
__clear_counters()
__emm_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE EMM messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.AuthKpiAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage RRC connection success rate

__calculate_kpi()
__clear_counters()
__emm_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE EMM messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.DedicatedBearerSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage Dedicated EPS bearer setup success rate

__calculate_kpi()
__esm_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE ESM messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.HoSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

A KPI analyzer to monitor and manage RRC connection success rate

__ho_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE RRC messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.IpDlTputAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage uplink latency breakdown

__msg_callback(msg)
set_source(source)

Set the trace source. Enable the cellular signaling messages

Parameters

source – the trace source (collector).

time_diff(pdu1, pdu2)
class mobile_insight.analyzer.kpi.KPIManager

Bases: mobile_insight.analyzer.analyzer.Analyzer

An unified interface for users to track and query KPIs

__check_kpis()

Find and include all supported KPIs into KPIManager.supported_kpis

enable_all_kpis(enable_storage=False)

Enable all KPIs’ monitoring

Parameters

enable_storage (boolean) – Whether to locally store the kpi. False by default

enable_kpi(kpi_name, periodicity='0s', cell=None, enable_storage=True)

Enable the KPI monitoring

Parameters
  • kpi_name (string) – The KPI to be monitored

  • enable_storage (boolean) – Whether to locally store the kpi. False by default

Returns

True if successfully activated, False otherwise

list_kpis()

Return a list of available KPIs

Returns

a list of string, each of which is a KPI name

local_query_kpi(kpi_name, mode='cell', timestamp=None)

Query the phone’s locally observed KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • timestamp (datetime) – The timestamp of the KPI. If None, this function returns the latest KPI

Returns

The KPI value, or None if the KPI is not available

remote_query_kpi(kpi_name, phone_model, operator, gps, timestamp)

Query the remote cloud for the KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • phone_model (string) – The the phone model

  • operator (string) – The network operator

  • gps (string) – The GPS coordinate

  • timestamp (datetime) – The timestamp of the KPI.

Returns

The KPI value, or None if the KPI is not available

supported_kpis = {}
class mobile_insight.analyzer.kpi.KpiAnalyzer

Bases: mobile_insight.analyzer.analyzer.Analyzer

An abstraction for KPI analyzer. It offers three functions

  1. Helpers to simplify the development of KPI tracking

  2. Automation of the KPI local storage management

  3. Automation of the KPI uploading to KPI map (cloud).

__create_db()

Create a local database for the KPI. The database is stored at /sdcard/mobileinsight/kpi/

Returns

True if the database is successfully created (or already exists), False otherwise

__create_table(kpi_name, attributes)

Create SQL tables for the kpi

Parameters
  • kpi_name (string) – name of the kpi

  • attributes (None or a list of attributes) –

__db_query(sql_cmd)

Return query result of a sql_cmd

__get_current_gps()
__get_operator_info()
__get_phone_model()
__log_kpi(kpi_name, timestamp, cell_id, kpi_value)
Parameters

kpi_name (string) – The KPI to be queried

:param timestamp :type timestamp: datetime :param cell_id: updated kpi cell id :type cell_id: string

__upload_kpi_async(kpi_name, kpi_value, cur_location)

Upload the KPI value to the cloud

Parameters
  • kpi_name (string) – The KPI to be queried

  • kpi_value (string) – The value of KPI

__upload_kpi_thread(e)

Internal thread to upload the KPI

enable_local_storage(enable_storage)

Set if the local KPI should be stored

Parameters

enable_storage (boolean) – Whether to locally store the kpi. False by default

list_kpis()

Return a list of available KPIs

Returns

a list of string, each of which is a KPI name

local_query_kpi(kpi_name, cell_id=None, timestamp=None)

Query the phone’s locally observed KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • cell_id (string) – cell global id

  • timestamp (datetime) – The timestamp of the KPI. If None, this function returns the latest KPI

Returns

The KPI value, or None if the KPI is not available

pending_upload_task = deque([])
register_kpi(kpi_type, kpi_name, callback, attributes=None)

Declare a KPI to be supported

Parameters
  • kpi_type (string) – The type of the KPI (accessibility, retainability, mobility, availability, …)

  • kpi_name (Python method) – The name of the KPI

  • callback – The callbacks to update the KPI

  • attributes (None or a list of attributes) –

Returns

True if the registeration succeeds, False otherwise (e.g., KPI already exists)

remote_query_kpi(kpi_name, phone_model, operator, gps, timestamp)

Query the remote cloud for the KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • phone_model (string) – The the phone model

  • operator (string) – The network operator

  • gps (string) – The GPS coordinate

  • timestamp (datetime) – The timestamp of the KPI.

Returns

The KPI value, or None if the KPI is not available

set_cell(kpi_showname, cell)

Set periodicity of the analyzer

Parameters
  • kpi_showname (string) – The KPI to be queried, this is the showname

  • cell (string) – cell (s,m,h,d repsents scale of seconds, minutes, hours, days)

set_operator(operator)

Set operator :param operator: string :return:

set_periodicity(kpi_showname, periodicity)

Set periodicity of the analyzer

Parameters
  • kpi_showname (string) – The KPI to be queried, this is the showname

  • periodicity (string) – periodicity (s,m,h,d repsents scale of seconds, minutes, hours, days)

set_phone_model(phone_model)

Set phone model :param phone_model: string :return:

store_kpi(kpi_name, kpi_value, timestamp, cur_location=None)

Store the KPIs to the local database

Parameters
  • kpi_name (string) – The KPI to be queried

  • kpi_value (string) – The value of KPI or a dict {attribute <type: str>: value <type: str>}

:param timestamp :type timestamp: datetime

upload_kpi(kpi_name, kpi_value)

Upload the KPI value to the cloud

Parameters
  • kpi_name (string) – The KPI to be queried

  • kpi_value (string) – The value of KPI

upload_thread = None
class mobile_insight.analyzer.kpi.LteBandwidthPredictor

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

__cell_info_callback(msg)
__msg_callback(msg)
predict_bandwidth(rsrq, snr, nRB_allocated, MCS, CQI, ri)

Estimate the globally available bandwdith in Mbps

set_source(source)

Set the trace source. Enable the cellular signaling messages

Parameters

source – the trace source (collector).

class mobile_insight.analyzer.kpi.LteHandoverDisruptionAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

__compute_disruption(ts)
__msg_callback(msg)
set_source(source)

Set the trace source. Enable the cellular signaling messages

Parameters

source – the trace source (collector).

class mobile_insight.analyzer.kpi.LteHandoverDuplicateAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

__msg_callback(msg)
set_source(source)

Set the trace source. Enable the cellular signaling messages

Parameters

source – the trace source (collector).

class mobile_insight.analyzer.kpi.LteHandoverPredictionAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

A function analyzer that models mobility management. It offers two functions

  1. Mobility event notification

  2. A complete mobility history and configuration query

  3. A handoff rule inference module

__get_meas_obj(msg)

Parse MeasObjectToAddMod_element, return a measurement object

Parameters

msg – the XML msg with MeasObjectToAddMod_element

Returns

a measurement objects to be added

__get_report_config(msg)

Parse ReportConfigToAddMod_element, return a report config

Parameters

msg – the XML msg with ReportConfigToAddMod_element

Returns

a measurement objects to be added

__on_lte_rrc_msg(msg)

Handle LTE RRC messages. It updates the mobility state, recovers the partial state transition, and then the entire handoff mobility graph

Parameters

msg – the event (message) from the trace collector.

reset()

Reset the state machine

set_handoff_prediction(b_predict)

Enable/disable handoff prediction

Parameters

b_prediction (boolean) – True if prediction should be enabled, False otherwise

class mobile_insight.analyzer.kpi.LtePdcpGapAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

__msg_callback(msg)
_callback_pdcp_dl(msg)
set_source(source)

Set the source of the trace. The messages from the source will drive the analysis.

Parameters
  • source – the source trace collector

  • type – trace collector

class mobile_insight.analyzer.kpi.LteQosAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to reveal Wireless errors (symbol errors, corruptions, etc.)

__msg_callback(msg)
set_source(source)

Set the trace source. Enable the LTE RRC messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.LteWirelessErrorAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to reveal Wireless errors (symbol errors, corruptions, etc.)

__msg_callback(msg)
set_source(source)

Set the trace source. Enable the LTE RRC messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.PhyKpiAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage uplink latency breakdown

__kpi_callback(msg)
__update_modulation_scheme()
__update_pusch_cqi()
class mobile_insight.analyzer.kpi.PhyRlmAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

A protocol ananlyzer for LTE Radio Resource Control (RRC) protocol.

__rlm_filter(msg)

Filter all LTE RRC packets, and call functions to process it

Parameters

msg – the event (message) from the trace collector.

set_source(source)

Set the trace source. Enable the LTE RLM messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.RrcConfigAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage RRC connection success rate

__rrc_config_callback(msg)
set_source(source)

Set the trace source. Enable the LTE RRC messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.RrcSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

A KPI analyzer to monitor and manage RRC connection success rate

__calculate_kpi()
__clear_counters()
__clear_kpi()
__rrc_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE RRC messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.ServiceReqSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage tracking area update success rate

__calculate_kpi()
__clear_counters()
__emm_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE ESM messages.

Parameters

source (trace collector) – the trace source.

class mobile_insight.analyzer.kpi.TauSrAnalyzer

Bases: mobile_insight.analyzer.kpi.kpi_analyzer.KpiAnalyzer

An KPI analyzer to monitor and manage tracking area update success rate

__calculate_kpi()
__clear_counters()
__emm_sr_callback(msg)
set_source(source)

Set the trace source. Enable the LTE ESM messages.

Parameters

source (trace collector) – the trace source.