def get_ltop_list(): ltop_data_list = {} ltop_handler_var = ltop_handler() ltop_handler_var.parse(conf_tool.get_base_path() + os.path.sep + conf_tool.get_ltop_file_path()) ltop_data_list['ostlist'] = ltop_handler_var.ltop_ost_list ltop_data_list['mdtlist'] = ltop_handler_var.ltop_mdt_list return ltop_data_list
def get_ltop_list(): ltop_data_list = {} ltop_handler_var = ltop_handler() ltop_handler_var.parse(conf_tool.get_base_path() + os.path.sep + conf_tool.get_ltop_file_path()) ltop_data_list['ostlist'] = ltop_handler_var.ltop_ost_list ltop_data_list['mdtlist'] = ltop_handler_var.ltop_mdt_list print("total_lines:%d, invalid_lines:%d, repeated_lines:%d" % (ltop_handler_var.total_lines, ltop_handler_var.invalid_lines, ltop_handler_var.repeated_lines)) return ltop_data_list
def ltop_file_filter(): ltop_file_path = conf_tool.get_base_path( ) + os.path.sep + conf_tool.get_ltop_file_path() filtered_content = '' with open(ltop_file_path, "r+") as ltop_file: line_str = ltop_file.readline() while line_str: if line_str and ("OST" in line_str or "ost" in line_str or "MDT" in line_str or "mdt" in line_str): filtered_content += line_str line_str = ltop_file.readline() with open(ltop_file_path, "w") as ltop_file: ltop_file.write(filtered_content)
def get_ltop_mdtlist(): ltop_handler_var = ltop_handler() ltop_handler_var.parse_mdt(conf_tool.get_base_path() + os.path.sep + conf_tool.get_ltop_file_path()) return ltop_handler_var.ltop_mdt_list