def kpi_analysis(filename): # Get analyzer and log dir from the user src = OfflineReplayer() # src.set_input_path('../../../logs/0.qmdl') # src.set_input_path('../../../logs/exp30_HFDV_byYJ/example.qmdl') src.set_input_path(filename) # analyzer = LteCntAnalyzer() # analyzer = DlLatBdAnalyzer() analyzer = UlSampleAnalyzer() # analyzer = UlLatBreakdownAnalyzer() analyzer.set_source(src) # analyzer = LtePdcpGapAnalyzer() # analyzer.set_source(src) # analyzer1 = PktLossAnalyzer() # analyzer1.set_source(src) # analyzer2 = RlcUlRetxAnalyzer() # analyzer2.set_source(src) # analyzer.set_operator("hello") # analyzer.set_phone_model("hi") # Start the monitoring src.run()
def parse_qmdl(plainTextFile): # Initialize an OfflineReplayer as monitor src = OfflineReplayer() m = MobilityMisconfigAnalyzer() for f in get_sorted_logs(plainTextFile): print '=========' + f + '========' m.reset() m.set_source(src) src.set_input_path(f) # Start the monitoring src.run() lte_mobility_misconfig_serving_cell_dict = m.get_lte_mobility_misconfig_serving_cell_dict( ) utra_mobility_misconfig_serving_cell_dict = m.get_3g_mobility_misconfig_serving_cell_dict( ) for CellIdentityCombine, CellInfo in lte_mobility_misconfig_serving_cell_dict.iteritems( ): print CellIdentityCombine jsonValue = json.dumps(CellInfo, indent=4, sort_keys=True) print jsonValue print "-----------------------------------------------------------" for CellIdentityCombine, CellInfo in utra_mobility_misconfig_serving_cell_dict.iteritems( ): print CellIdentityCombine jsonValue = json.dumps(CellInfo, indent=4, sort_keys=True) print jsonValue print "-----------------------------------------------------------"
def ReadRawFile(filename): # Initialize a 3G/4G monitor src = OfflineReplayer() #src.set_input_path("./diag_log_20190701_032740_93cda9833356d6bc90e05d0f85b3efee_Google-PixelXL_311480.mi2log") src.set_input_path("./" + filename + ".mi2log") logger = MsgLogger() logger.set_decode_format(MsgLogger.XML) logger.set_dump_type(MsgLogger.FILE_ONLY) #logger.save_decoded_msg_as("./test.txt") logger.save_decoded_msg_as("./" + filename + ".txt") logger.set_source(src) # Analyzers lte_pdcp_analyzer = LtePdcpAnalyzer() lte_pdcp_analyzer.set_source(src) lte_rrc_analyzer = LteRrcAnalyzer() lte_rrc_analyzer.set_source(src) # bind with the monitor wcdma_rrc_analyzer = WcdmaRrcAnalyzer() wcdma_rrc_analyzer.set_source(src) # bind with the monitor lte_nas_analyzer = LteNasAnalyzer() lte_nas_analyzer.set_source(src) umts_nas_analyzer = UmtsNasAnalyzer() umts_nas_analyzer.set_source(src) lte_phy_analyzer = LtePhyAnalyzer() lte_phy_analyzer.set_source(src) lte_mac_analyzer = LteMacAnalyzer() lte_mac_analyzer.set_source(src) mm_analyzer = MmAnalyzer() mm_analyzer.set_source(src) lte_measurement_analyzer = LteMeasurementAnalyzer() lte_measurement_analyzer.set_source(src) lte_rlc_analyzer = LteRlcAnalyzer() lte_rlc_analyzer.set_source(src) #modem_Debug_Analyzer = ModemDebugAnalyzer() #modem_Debug_Analyzer.set_source(src) mobility_mngt = MobilityMngt() mobility_mngt.set_source(src) rrc_analyzer = RrcAnalyzer() rrc_analyzer.set_source(src) # Start the monitoring src.run()
def uplink_latency_analysis(): src = OfflineReplayer() # src.set_input_path("./logs/latency_sample.mi2log") src.set_input_path(sys.argv[1]) # print (sys.argv[1]) analyzer = UplinkLatencyAnalyzer() analyzer.set_source(src) src.run() return analyzer
def __init__(self, listener_callback): Analyzer.__init__(self) # a message dump has no analyzer in from/to_list # it only has a single callback for the source self.msg_logs = [] # in-memory message log self.src = OfflineReplayer() self.set_source(self.src) self.add_source_callback(self.__dump_message) self.listener_callback = listener_callback self.supported_types = set(dm_collector_c.log_packet_types) for st in self.supported_types: self.src.enable_log(st)
def kpi_analysis(): src = OfflineReplayer() src.set_input_path(sys.argv[1]) analyzer = DLMacLatencyAnalyzer() analyzer.set_source(src) src.run() analyzer.log_info('Total packets: ' + str(analyzer.num)) analyzer.log_info('Number of TX delay: ' + str(analyzer.tx_delay_num)) analyzer.log_info('Number of blocked packets: ' + str(analyzer.block_delay_num))
def test(self): #Single analyzer test only Analyzer.reset() src = OfflineReplayer() src.set_input_path(log_path) #Indirectly call analyzer via include_analyzer test_analyzer = Analyzer() test_analyzer.include_analyzer(analyzer_name, []) test_analyzer.set_source(src) # Disable all MobileInsight logs logging.getLogger('mobileinsight_logger').setLevel(logging.CRITICAL) src.run()
def kpi_manager_example(path): src = OfflineReplayer() src.set_input_path(path) kpi_manager = KPIManager() # print "All supported KPIs:", str(kpi_manager.list_kpis()) # kpi_manager.enable_kpi("KPI.Accessibility.DEDICATED_BEARER_SR_QCI1_REQ", periodicity='10m') # kpi_manager.enable_kpi("KPI.Accessibility.DEDICATED_BEARER_SR_QCI1_SR", periodicity='2h') kpi_manager.enable_kpi("KPI.Accessibility.RRC_SUC") kpi_manager.enable_kpi("KPI.Accessibility.RRC_REQ") kpi_manager.enable_kpi("KPI.Accessibility.RRC_SR") kpi_manager.enable_kpi("KPI.Accessibility.RRC_LATENCY") kpi_manager.enable_kpi("KPI.Accessibility.SR_SUC") kpi_manager.enable_kpi("KPI.Accessibility.SR_REQ") kpi_manager.enable_kpi("KPI.Accessibility.SR_SR") kpi_manager.enable_kpi("KPI.Accessibility.SR_LATENCY") # kpi_manager.enable_kpi("KPI.Accessibility.ATTACH_SUC") # kpi_manager.enable_kpi("KPI.Accessibility.ATTACH_SR") # Test Mobility KPIs kpi_manager.enable_kpi("KPI.Mobility.HO_TOTAL") kpi_manager.enable_kpi("KPI.Mobility.HO_FAILURE") kpi_manager.enable_kpi("KPI.Mobility.HO_FAILURE_LATENCY") kpi_manager.enable_kpi("KPI.Mobility.HO_SR") kpi_manager.enable_kpi( "KPI.Mobility.HANDOVER_LATENCY") # test log: data_sample kpi_manager.enable_kpi("KPI.Accessibility.HO_LATENCY") kpi_manager.enable_kpi("KPI.Mobility.TAU_SUC") kpi_manager.enable_kpi("KPI.Mobility.TAU_REQ") kpi_manager.enable_kpi("KPI.Mobility.TAU_SR") kpi_manager.enable_kpi("KPI.Mobility.TAU_LATENCY") # kpi_manager.enable_kpi("KPI.Mobility.TAU_REQ", periodicity='1h') # Test Retainability KPIs # kpi_manager.enable_kpi("KPI.Retainability.RRC_AB_REL") # Test Integrity KPIs # kpi_manager.enable_kpi("KPI.Integrity.DL_TPUT") kpi_manager.set_source(src) src.run()
def parse_qmdl(path_input): # directory = "/home/moonsky219/ownCloud/mssn/misconfig_exp/data/Verizon/L714/" directory = path_input logs = get_sorted_logs(directory) # Initialize a 3G/4G monitor src = OfflineReplayer() m = IdleHandoffAnalyzer() for f in logs: # print "=== %s ===" % f m.reset() m.set_source(src) src.set_input_path(f) # Start the monitoring src.run()
def kpi_manager_example(path): src = OfflineReplayer() src.set_input_path(path) kpi_manager = KPIManager() # print "All supported KPIs:", str(kpi_manager.list_kpis()) # Test experimental KPIs - data plane kpi_manager.enable_kpi("KPI.Wireless.BLER") # test log: bler_sample kpi_manager.enable_kpi("KPI.Wireless.DL_PDCP_LOSS") # test log: data_sample kpi_manager.enable_kpi("KPI.Wireless.UL_PDCP_LOSS") # Test experimental KPIs - handover kpi_manager.enable_kpi("KPI.Mobility.HANDOVER_PREDICTION") # test log: data_sample kpi_manager.enable_kpi("KPI.Mobility.HANDOVER_LATENCY") # test log: data_sample kpi_manager.enable_kpi("KPI.Mobility.HANDOVER_HOL") # test log: data_sample kpi_manager.set_source(src) src.run()
def lte_phy_analysis(): src = OfflineReplayer() #src.set_input_path("./logs/latency_sample.mi2log") src.set_input_path(sys.argv[1]) # print (sys.argv[1]) phy_analyzer = goodsol_analyzer.MyAnalyzer() #phy_analyzer.set_source(src) meas_analyzer = lte_measurement_analyzer.LteMeasurementAnalyzer() meas_analyzer.set_source(src) uplink_analyzer = uplink_latency_analyzer.UplinkLatencyAnalyzer() #uplink_analyzer.set_source(src) mac_analyzer = lte_mac_analyzer.LteMacAnalyzer() #mac_analyzer.set_source(src) rlc_analyzer = lte_rlc_analyzer.LteRlcAnalyzer() rlc_analyzer.set_source(src) error_analyzer = lte_wireless_error_analyzer.LteWirelessErrorAnalyzer() #error_analyzer.set_source(src) fb_analyzer = object_latency_analyzer.ObjectLatencyAnalyzer() fb_analyzer.set_source(src) pdcp_analyer = lte_pdcp_ulgap_analyzer.LtePdcpUlGapAnalyzer() #pdcp_analyer.set_source(src) #mac_analyzer = lte_mac_analyzer.LteMacAnalyzer() #mac_analyzer.set_source(src) rrc_analyzer = lte_rrc_analyzer.LteRrcAnalyzer() #rrc_analyzer.set_source(src) src.run() return phy_analyzer, meas_analyzer, mac_analyzer, rlc_analyzer, fb_analyzer, pdcp_analyer
def generate_from_mi2log(filepath, output_filepath=None): src = OfflineReplayer() src.set_input_path(filepath) filename = get_filename_from_path(filepath) logger = MsgLogger() logger.set_decode_format(MsgLogger.XML) logger.set_dump_type(MsgLogger.FILE_ONLY) if (output_filepath is not None): op_fp = output_filepath else: op_fp = "./mi2log_xml/" + filename + "_" + datetime.now().strftime( "%H_%M_%S") + '.xml' logger.save_decoded_msg_as(op_fp) logger.set_source(src) # Analyzers lte_rrc_analyzer = LteRrcAnalyzer() lte_rrc_analyzer.set_source(src) # bind with the monitor # wcdma_rrc_analyzer = WcdmaRrcAnalyzer() # wcdma_rrc_analyzer.set_source(src) # bind with the monitor lte_nas_analyzer = LteNasAnalyzer() lte_nas_analyzer.set_source(src) # umts_nas_analyzer = UmtsNasAnalyzer() # umts_nas_analyzer.set_source(src) # lte_phy_analyzer = LtePhyAnalyzer() # lte_phy_analyzer.set_source(src) # lte_mac_analyzer = LteMacAnalyzer() # lte_mac_analyzer.set_source(src) # Start the monitoring src.run() clean_mi2log_xml(op_fp)
elif (dl_size < ul_size and not (dl_size < 75 and ul_size > 94) ) or (ul_size < 75 and dl_size > 94 and (ul_sfn > dl_sfn or ul_sfn - dl_sfn < -8000)): dl_pointer += 1 else: ul_pointer += 1 print "ul_size, ul_fn_sfn, ul_timestamp, dl_size, dl_fn_sfn, dl_timestamp, first_dl_fn_sfn, dl_trans_delay, e2e_delay" for i in joint_delay: if 0 < i[4] - i[1] < 600: print ','.join(map(str, i + [i[4] - i[1]])) if __name__ == "__main__": if len(sys.argv) != 2: print "Usage python example_pdcp.py [path to mi2log file]" exit() # Initialize a 3G/4G monitor src = OfflineReplayer() src.set_input_path(sys.argv[1]) dumpAnalyzer = DumpAnalyzer() dumpAnalyzer.set_source(src) # Start the monitoring src.run() dumpAnalyzer.post_process()
def parse_qmdl(path_input): # directory = "/home/moonsky219/ownCloud/mssn/misconfig_exp/data/Verizon/L714/" directory = path_input logs = get_sorted_logs(directory) # Initialize a 3G/4G monitor src = OfflineReplayer() m = MobilityMisconfigAnalyzer() for f in logs: # print "=== %s ===" % f m.reset() m.set_source(src) src.set_input_path(f) # Start the monitoring src.run() umts_normal_service_log = m.get_umts_normal_service_log() umts_plmn_search_log = m.get_umts_plmn_search_log() umts_attach_log = m.get_umts_attach_log() umts_lu_log = m.get_umts_lu_log() umts_rau_log = m.get_umts_rau_log() lte_normal_service_log = m.get_lte_normal_service_log() lte_plmn_search_log = m.get_lte_plmn_search_log() lte_attach_log = m.get_lte_attach_log() lte_tau_log = m.get_lte_tau_log() lte_tau_qos_info = m.get_lte_tau_qos_info() lte_cell_resel_to_umts_config = m.get_lte_cell_resel_to_umts_config() lte_drx_config = m.get_lte_drx_config() lte_tdd_config = m.get_lte_tdd_config() n_lte_rrc_reconfig = m.get_n_lte_rrc_reconfig() lte_mobility_misconfig_serving_cell_dict = m.get_lte_mobility_misconfig_serving_cell_dict( ) utra_mobility_misconfig_serving_cell_dict = m.get_3g_mobility_misconfig_serving_cell_dict( ) for CellIdentityCombine, CellInfo in lte_mobility_misconfig_serving_cell_dict.iteritems( ): print CellIdentityCombine InfoKey = "lte_rrc_cerv_cell_info" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib1]" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib3]cellReselectionInfoCommon_element" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib3]cellReselectionServingFreqInfo_element" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib3]intraFreqCellReselectionInfo_element" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib4]intraFreqBlackCellList" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib4]intraFreqNeighCellList" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib5]InterFreqCarrierFreqInfo_element" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib5]interFreqBlackCellList" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib5]interFreqNeighCellList" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib6]CarrierFreqUTRA_FDD_element" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib7]" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "[sib8]" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "lte_rrc_measurement_report" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "lte_measurement_report_config" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "lte_measurement_object" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "utra_3g_measurement_object" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "lte_report_configuration" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "2g3g_report_reconfiguration" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem print "-----------------------------------------------------------" for CellIdentityCombine, CellInfo in utra_mobility_misconfig_serving_cell_dict.iteritems( ): print CellIdentityCombine for InfoKey, InfoValue in CellInfo.iteritems(): if InfoKey == "umts_geolocation": continue print InfoKey if isinstance(InfoValue, list): for InfoValueItem in InfoValue: print InfoValueItem elif isinstance(InfoValue, dict): for InfoValueKey, InfoValueItem in InfoValue: print InfoValueKey print InfoValueItem print "-----------------------------------------------------------"
def parse_qmdl(plainTextFile): # Initialize an OfflineReplayer as monitor src = OfflineReplayer() m = MobilityMisconfigGsmCdmaAnalyzer() for f in get_sorted_logs(plainTextFile): m.reset() m.set_source(src) src.set_input_path(f) # Start the monitoring src.run() gsm_mobility_misconfig_serving_cell_dict = m.get_gsm_mobility_misconfig_serving_cell_dict( ) cdma_mobility_misconfig_serving_cell_dict = m.get_cdma_mobility_misconfig_serving_cell_dict( ) evdo_mobility_misconfig_serving_cell_dict = m.get_evdo_mobility_misconfig_serving_cell_dict( ) filename = str(f) print filename carrier = "Unknown" try: carrier = (filename.split('.mi2log')[0]).split('_')[-1] except: carrier = "Unknown" for CellIdentityCombine, CellInfo in gsm_mobility_misconfig_serving_cell_dict.iteritems( ): CellIdentityCombine = (carrier, ) + CellIdentityCombine print CellIdentityCombine InfoKey = "gsm_cell_information" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "gsm_reselection_parameters" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem print "-----------------------------------------------------------" for CellIdentityCombine, CellInfo in cdma_mobility_misconfig_serving_cell_dict.iteritems( ): CellIdentityCombine = (carrier, ) + CellIdentityCombine print CellIdentityCombine InfoKey = "cdma_paging" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem print "-----------------------------------------------------------" for CellIdentityCombine, CellInfo in evdo_mobility_misconfig_serving_cell_dict.iteritems( ): CellIdentityCombine = (carrier, ) + CellIdentityCombine print CellIdentityCombine InfoKey = "evdo_sector_parameters" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem InfoKey = "evdo_other_rat" if InfoKey in CellInfo: print InfoKey for InfoValueItem in CellInfo[InfoKey]: print InfoValueItem print "-----------------------------------------------------------"
def kpi_analysis(): # src = OfflineReplayer() # src.set_input_path('/sdcard/mobileinsight/plugins/test_analyzer/vr_log.mi2log') # cache_directory = mi2app_utils.get_cache_dir() # log_directory = os.path.join(cache_directory, "mi2log") src = OfflineReplayer() src.set_input_path(sys.argv[1]) analyzer = UlRLCAnalyzer() analyzer.set_source(src) # analyzer.set_idx(3) src.run() x = [] y = [] for row in analyzer.pdu_pkts: x.append(row[0]) y.append(row[2]) x1 = [] y1 = [] for row in analyzer.pdu_pkts: x1.append(row[1]) y1.append(row[2]) x2 = [] y2 = [] for row in analyzer.receive_buffer_backup: x2.append(row[1]) y2.append(row[0]) x3 = [] y3 = [] for row in analyzer.pdcp_rx: x3.append(row[0]) y3.append(row[1]) total = len(analyzer.receive_buffer_backup) send = len(analyzer.pdu_pkts) analyzer.log_info("Total Recieve Package: " + str(total)) print "Total Recieve Package: " + str(total) # analyzer.log_info("Total Send PDCP Package: " + str(send)) analyzer.log_info("Total Match Package: " + str(analyzer.match)) print "Total Match Package: " + str(analyzer.match) analyzer.log_info("Average wait delay: " + str(analyzer.total_wait_delay/analyzer.match)) print "Average wait delay: " + str(analyzer.total_wait_delay/analyzer.match) analyzer.log_info("Average TX delay: " + str(analyzer.total_tx_delay/analyzer.match)) print "Average TX delay: " + str(analyzer.total_tx_delay/analyzer.match) plt.scatter(x3,y3,s=5, color = 'y', label = 'retransmission') plt.scatter(x2,y2,s=10, color = 'g',label = 'buffer recieve') plt.scatter(x1,y1,s=5, color = 'b', label='pdcp package finish sending') plt.scatter(x,y,s=2,color='r', label='pdcp package start sending') plt.xlabel('Timestamp') plt.ylabel('Package Size') plt.title(sys.argv[1]) plt.legend() plt.show()