Ejemplo n.º 1
0
def Check_Enter_ioctl_Timestamp(log_file, start_index, check_option):
    cmd = "grep " + "ts_ioctl" + " " + log_file + " |awk -F \" \" \'{print $2}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $1}\'"
    output = connections.execute_mml_without_check( cmd )
    timer_s = output.strip().splitlines()
    s_line_count = len(timer_s)
    print timer_s
    cmd = "grep " + "ts_ioctl" + " " + log_file + " |awk -F \" \" \'{print $2}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $2}\'"
    output = connections.execute_mml_without_check( cmd )
    timer_ms = output.strip().splitlines()
    ms_line_count = len(timer_ms)
    print timer_ms
    index_s = int(start_index)
    if ms_line_count < (index_s + 2):
        return 'failure: not received enough message'
    s_gap = int(timer_s[index_s+1]) - int(timer_s[index_s])
    print "s gap is: %d \n" %s_gap
    ms_gap = int(timer_ms[index_s+1]) - int(timer_ms[index_s])
    print "ms gap is: %d \n" %ms_gap
    
    if check_option == 'INCRE':
        if s_gap > 0:
            return "successful"
        else:        
            if ms_gap > 0:
                return "successful"
            else:
                return "error"
    if check_option == 'RANDOM':
        if s_gap == 0 and ms_gap == 0:
            return "successful"
        else:
            return "error"
Ejemplo n.º 2
0
def Get_Snapshot_Log_Count(log_file):
    log_count = 0
    cmd = "grep " + "'kernel: dmxmsg: snapshot:'" + " " + log_file
    output = connections.execute_mml_without_check(cmd)
    log_count = len(output.strip().splitlines())
    if log_count == 0:
        print "There is no snapshot log"
    return str(log_count)
Ejemplo n.º 3
0
def check_node_up_by_mac():
    command = 'cat /proc/dmxmsg/mac_addr_tbl'
    output = connections.execute_mml_without_check(command)
    mac_table = output.strip()
    match1 = re.findall("unavailable", mac_table)

    if len(match1) == 0:
        return "sucessful"  #no unavailable node
    else:
        return "fail"
Ejemplo n.º 4
0
def Check_Node_Mac_State(phy_addr, expect_str):
    cmd = "cat /proc/dmxmsg/mac_addr_tbl"
    output = connections.execute_mml(cmd)
    mac_table = output.strip()
    re_item = '00%s(?=\s*%s)' % (phy_addr, expect_str)
    match = re.findall(re_item, mac_table)
    if len(match) > 0:
        output = "sucessful"
    else:
        output = "fail"
    return output
Ejemplo n.º 5
0
def check_node_state_normal(node_name):
    command = 'fshascli -s /' + node_name
    output = connections.execute_mml_without_check(command)
    print output
    state_table = output.strip()
    match1 = re.findall("(ENABLED)", state_table)
    match2 = re.findall("(ACTIVE)", state_table)
    match3 = re.findall("(INITIALIZING)", state_table)
    if len(match1) > 0 and len(match2) > 0 and len(match3) == 0:
        return "sucessful"
    else:
        return "fail"
Ejemplo n.º 6
0
def create_low_memory(disk_file):
    command = "free"
    output = connections.execute_mml_without_check(command)
    print output
    command = "free -g | grep Mem: |awk -F \" \" \'{print $4}\'"
    output = connections.execute_mml_without_check(command)
    memo_g = output.strip()
    print "create memory %s G" % memo_g
    mount_size = int(memo_g) + 1
    mount_size = str(mount_size)
    command = 'mkdir ' + disk_file
    connections.execute_mml_without_check(command)
    command = 'mount -t tmpfs -o nosuid,mode=777,size=' + mount_size + 'G,rw tmpfs ' + disk_file
    connections.execute_mml_without_check(command)
    command = 'cd ' + disk_file
    connections.execute_mml_without_check(command)

    command = 'dd if=/dev/zero of=emptyfile bs=1M count=' + memo_g + '000'
    output = connections.execute_mml_without_check(command)

    command = "free"
    output = connections.execute_mml_without_check(command)
    print output
    command = "free -m | grep Mem: |awk -F \" \" \'{print $4}\'"
    output = connections.execute_mml_without_check(command)
    memo_m = output.strip()
    print "memo_m is: %s M" % memo_m
    cp_size = int(memo_m, 10)
    cp_size = cp_size / 2 - 10
    size = str(cp_size)
    print "write buffer %s M" % size

    command = 'dd if=/dev/zero of=occupyfile bs=1M count=' + size
    output = connections.execute_mml_without_check(command)

    command = 'cd /root;'
    output = connections.execute_mml_without_check(command)
    command = 'free;ll ' + disk_file + "/*"
    output = connections.execute_mml_without_check(command)
    print output
Ejemplo n.º 7
0
def Get_Rds_Rx_Link_Table(node_phy_addr):
    """This keyword is to get rds_link_tbl info
		| Parameters      | Man. | Description                                  |
        | node_phy_addr   | Yes  | node physical address                        |
    """

    cmd = 'cat /proc/dmxmsg/rds_link_tbl'
    output = connections.execute_mml(cmd)
    result = output.strip()

    statistic_list = CommonItem()
    linktable_exist_flag = 0
    if len(result) > 0:
        re_item_peer = '(?<=PEER:)\w{4}\s*'
        re_item = '\s*[a-z\s.]+\s*(\d+)\s*'
        peer_node = re.findall(re_item_peer, result)
        link_data = re.findall(re_item, result)

        if link_data is not None:
            for count in range(len(peer_node)):
                if int(peer_node[count].strip(), 16) == int(node_phy_addr, 16):
                    i = (g_tx_items + g_rx_items - 1) * count + g_tx_items
                    statistic_list.rx_exp_frame_seq = link_data[i]
                    i += 1
                    statistic_list.rx_acked = link_data[i]
                    i += 1
                    statistic_list.rx_retr_req = link_data[i]
                    i += 1
                    statistic_list.rx_ack_err = link_data[i]
                    i += 1
                    statistic_list.rx_retr_req_err = link_data[i]
                    i += 1
                    statistic_list.rx_delayed_ack_timeout = link_data[i]
                    i += 1
                    statistic_list.rx_lost_frames = link_data[i]
                    i += 1
                    statistic_list.rx_dup_frame = link_data[i]
                    linktable_exist_flag = 1
                    break

    if linktable_exist_flag == 0:
        statistic_list.rx_exp_frame_seq = 0
        statistic_list.rx_acked = 0
        statistic_list.rx_retr_req = 0
        statistic_list.rx_ack_err = 0
        statistic_list.rx_retr_req_err = 0
        statistic_list.rx_delayed_ack_timeout = 0
        statistic_list.rx_lost_frames = 0
        statistic_list.rx_dup_frame = 0
    return statistic_list
Ejemplo n.º 8
0
def Get_Snapshot_Top_Five_PID_Count(log_file, recv_fam):
    cmd = "grep " + "'kernel: dmxmsg: snapshot:'" + " " + log_file
    output = connections.execute_mml_without_check(cmd)
    dumplog_list = output.strip().splitlines()
    log_cout = len(dumplog_list)
    msg_num = 0
    i = 0
    while i < log_cout:
        log_item = dumplog_list[i].strip()
        re_item_top = "\s*Top 5 PRBs in RU\s*"
        match_top = re.findall(re_item_top, log_item)
        if match_top:
            print "find top 5 prb log \n"
            re_item_fam = "(?<=\(0x%s\)=)\d*" % recv_fam
            match_fam = re.findall(re_item_fam, log_item)
            if match_fam:
                return match_fam[0].strip()
        i += 1
    print "There is no top log with receiver family 0x%s" % recv_fam
    return msg_num
Ejemplo n.º 9
0
def Get_Snapshot_Signal_Msg_Count(log_file, signal_num):
    cmd = "grep " + "'kernel: dmxmsg: snapshot:'" + " " + log_file
    output = connections.execute_mml_without_check(cmd)
    dumplog_list = output.strip().splitlines()
    log_cout = len(dumplog_list)
    msg_num = 0
    i = 0
    signal_hex_number = int(signal_num)
    while i < log_cout:
        log_item = dumplog_list[i].strip()
        re_item = "(?<=number:)\d*%X," % signal_hex_number
        match = re.findall(re_item, log_item)
        if match:
            doc_len = len(log_item.split(','))
            msg_num_str = log_item.split(',')[doc_len - 1]
            msg_num = msg_num_str.strip().split(' ')[1]
            return msg_num
        i += 1
    print "There is no log with number 0x%X" % signal_hex_number
    return msg_num
Ejemplo n.º 10
0
def Check_Snapshot_Time_Scape_Less_Then_Expected_Value(log_file, end_str,
                                                       expect_time):
    cmd = "grep '" + end_str + "' " + log_file
    output = connections.execute_mml_without_check(cmd)
    end_log = output.strip()
    if len(end_log) == 0:
        print "There is no end log"
        result = 0
    else:
        stack_time = end_log.split(',')[3]
        print stack_time
        time_value = stack_time.split('=')[1]
        if int(time_value) < int(expect_time):
            result = 1
        else:
            print "time value is: %s, expect_time is: %s\n" % (time_value,
                                                               expect_time)
            result = 0
    if result == 1:
        return "successful"
    else:
        return "error"
Ejemplo n.º 11
0
def Get_Snapshot_Sender_And_Signal_Count(log_file, send_fam, signal_num):
    cmd = "grep " + "'kernel: dmxmsg: snapshot:'" + " " + log_file
    output = connections.execute_mml_without_check(cmd)
    dumplog_list = output.strip().splitlines()
    log_cout = len(dumplog_list)
    msg_num = 0
    i = 0
    signal_hex_number = int(signal_num)
    while i < log_cout:
        log_item = dumplog_list[i].strip()
        re_item_sig = "(?<=number:)\d*%X," % signal_hex_number
        match_sig = re.findall(re_item_sig, log_item)
        if match_sig:
            re_item_fam = "(?<=PID:\d{4}:)\d*%s:\d{4}, attr:" % send_fam
            match_fam = re.findall(re_item_fam, log_item)
            if match_fam:
                doc_len = len(log_item.split(','))
                msg_num_str = log_item.split(',')[doc_len - 1]
                msg_num = msg_num_str.strip().split(' ')[1]
                return msg_num
        i += 1
    print "There is no log with sender family 0x%x, number 0x%X " % (
        send_fam, signal_hex_number)
    return msg_num
Ejemplo n.º 12
0
def Generic_Get_Rds_Sequence_Num(addr):
    Generic_Get_Rds_Link_Info(addr)
    cmd = "grep Frame_seq /tmp/generic.txt | cut -f 2 -d :"
    output = connections.execute_mml(cmd)
    output = output.strip()
    return output
Ejemplo n.º 13
0
def Get_Delay_Sync_Timeout():
    cmd = "cat /proc/dmxmsg/delay_sync_timeout"
    output = connections.execute_mml(cmd)
    size = output.strip()
    return size
Ejemplo n.º 14
0
def Get_Rds_Tx_Queue_Extra_Size():
    cmd = "cat /proc/dmxmsg/rds_tx_queue_extra_limit"
    output = connections.execute_mml(cmd)
    size = output.strip()
    return size
Ejemplo n.º 15
0
def Get_Rds_Sliding_Window_Size():
    cmd = "cat /proc/dmxmsg/rds_tx_win_size"
    output = connections.execute_mml(cmd)
    size = output.strip()
    return size
Ejemplo n.º 16
0
def Get_Rds_max_state_query_count():
    cmd = "cat /proc/dmxmsg/rds_max_state_query_count"
    output = connections.execute_mml(cmd)
    size = output.strip()
    return size
Ejemplo n.º 17
0
def Get_Rds_Tx_Link_Table(node_phy_addr):
    """This keyword is to get rds_link_tbl info
	    | Parameters      | Man. | Description                                  |
        | node_phy_addr   | Yes  | node physical address                        |
    """

    cmd = 'cat /proc/dmxmsg/rds_link_tbl'
    output = connections.execute_mml(cmd)
    result = output.strip()
    #    print "output is:%s" % output
    #    print "result is:%s" % result
    statistic_list = CommonItem()

    linktable_exist_flag = 0
    if len(result) > 0:

        re_item_peer = '(?<=PEER:)\w{4}\s*'
        re_item = '\s*[a-z\s.]+\s*(\d+)\s*'
        peer_node = re.findall(re_item_peer, result)
        link_data = re.findall(re_item, result)

        if link_data is not None:
            for count in range(len(peer_node)):
                if int(peer_node[count].strip(), 16) == int(node_phy_addr, 16):
                    i = (g_tx_items + g_rx_items - 1) * count
                    statistic_list.tx_frame_seq = link_data[i]
                    i += 1
                    statistic_list.tx_retr_timeout = link_data[i]
                    i += 1
                    statistic_list.tx_retr_frame = link_data[i]
                    i += 1
                    statistic_list.tx_recv_ack = link_data[i]
                    i += 1
                    statistic_list.tx_recv_retr_req = link_data[i]
                    i += 1
                    statistic_list.tx_dropped_ack = link_data[i]
                    i += 1
                    statistic_list.tx_dropped_retr_req = link_data[i]
                    i += 1
                    statistic_list.tx_win_start = link_data[i]
                    i += 1
                    statistic_list.tx_win_end = link_data[i]
                    i += 1
                    i += 1
                    statistic_list.tx_win_full = link_data[i]
                    i += 1
                    statistic_list.tx_queue_push_full = link_data[i]
                    i += 1
                    statistic_list.tx_sleep = link_data[i]
                    i += 6
                    statistic_list.tx_con_retr_timeout = link_data[i]
                    i += 1
                    statistic_list.tx_state_query_count = link_data[i]
                    linktable_exist_flag = 1
                    break

    if linktable_exist_flag == 0:
        statistic_list.tx_frame_seq = 0
        statistic_list.tx_retr_timeout = 0
        statistic_list.tx_retr_frame = 0
        statistic_list.tx_recv_ack = 0
        statistic_list.tx_recv_retr_req = 0
        statistic_list.tx_dropped_ack = 0
        statistic_list.tx_dropped_retr_req = 0
        statistic_list.tx_win_start = 0
        statistic_list.tx_win_end = 0
        statistic_list.tx_win_full = 0
        statistic_list.tx_queue_push_full = 0
        statistic_list.tx_sleep = 0
        statistic_list.tx_con_retr_timeout = 0
        statistic_list.tx_state_query_count = 0
    return statistic_list
Ejemplo n.º 18
0
def Get_Node_Process_Id():
    cmd = "cat /proc/dmxmsg/processor_index"
    output = connections.execute_mml(cmd)
    id = output.strip()
    return id
Ejemplo n.º 19
0
def Check_Timestamp_Order(log_file, check_option, check_index, expect_gap_s):
    cmd = "grep " + "ts_intrrupt" + " " + log_file + " |awk -F \" \" \'{print $1}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $1}\'"
    output = connections.execute_mml_without_check( cmd )
    pow_timer_s = output.strip().splitlines()
    pow_s_line_count = len(pow_timer_s)
    print "POW Timer S: "
    print pow_timer_s
    cmd = "grep " + "ts_intrrupt" + " " + log_file + " |awk -F \" \" \'{print $1}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $2}\'"
    output = connections.execute_mml_without_check( cmd )
    pow_timer_ms = output.strip().splitlines()
    pow_ms_line_count = len(pow_timer_ms)
    print "POW Timer MS: "
    print pow_timer_ms

    cmd = "grep " + "ts_ioctl" + " " + log_file + " |awk -F \" \" \'{print $2}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $1}\'"
    output = connections.execute_mml_without_check( cmd )
    ioctl_timer_s = output.strip().splitlines()
    ioctl_s_line_count = len(ioctl_timer_s)
    print "IOCTL Timer S: "
    print ioctl_timer_s
    cmd = "grep " + "ts_ioctl" + " " + log_file + " |awk -F \" \" \'{print $2}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $2}\'"
    output = connections.execute_mml_without_check( cmd )
    ioctl_timer_ms = output.strip().splitlines()
    ioctl_ms_line_count = len(ioctl_timer_ms)
    print "IOCTL Timer MS: "
    print ioctl_timer_ms
    
    cmd = "grep " + "ts_inqueue" + " " + log_file + " |awk -F \" \" \'{print $3}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $1}\'"
    output = connections.execute_mml_without_check( cmd )
    inq_timer_s = output.strip().splitlines()
    inq_s_line_count = len(inq_timer_s)
    print "INQUEUE Timer S: "
    print inq_timer_s
    cmd = "grep " + "ts_inqueue" + " " + log_file + " |awk -F \" \" \'{print $3}\' |awk -F \":\" \'{print $2}\' |awk -F \"-\" \'{print $2}\'"
    output = connections.execute_mml_without_check( cmd )
    inq_timer_ms = output.strip().splitlines()
    inq_ms_line_count = len(inq_timer_ms)
    print "INQUEUE Timer MS: "
    print inq_timer_ms
        
    index_s = int(check_index)
    if inq_ms_line_count < (index_s + 1):
        return 'failure: not received enough message'
    expect_gap = int(expect_gap_s)
###compare pow timer before queue timer###
    gap = int(inq_timer_s[index_s]) - int(pow_timer_s[index_s])
    print "pow timer before queue timer %d s" %gap
    if check_option == 'POWINQ':        
        if gap >= expect_gap:
            return "successful"
        else:
            return "error"
    else:        
        if gap <= 0:
            if gap == 0:
                ms_gap = int(inq_timer_ms[index_s]) - int(pow_timer_ms[index_s])
                if ms_gap > 0:
                    print "pow timer before queue timer %d ms" %ms_gap
                else:
                    print "error: pow timer equal queue timer at s, but after ms"
                    return "error"
            else:
                print "error: pow timer after queue timer at s"
                return "error"
###compare ioctl timer before pow timer###                    
    if check_option == 'IOFIRST':
        gap = int(pow_timer_s[index_s]) - int(ioctl_timer_s[index_s])
        print "IOFIRST: ioctl timer before pow timer %d s" %gap
        if gap >= expect_gap:            
            return "successful"
        else:
            return "error"

###compare ioctl timer afte queue timer###
    if check_option == 'IOLAST':
        gap = int(ioctl_timer_s[index_s]) - int(inq_timer_s[index_s])
        print "IOLAST: queue timer before ioctl timer %d s" %gap
        if gap >= expect_gap:            
            return "successful"
        else:
            return "error"
            
    print "no option"
    return "error"
Ejemplo n.º 20
0
def Get_Reorder_Queue_Timeout():
    cmd = "cat /proc/dmxmsg/g_reorder_queue_empty_check_time"
    output = connections.execute_mml(cmd)
    size = output.strip()
    return size