def wait_unit_up(self, unit="", max_wait=480):
        if unit == "":
            unit = TestResources.getResources('UNIT')

        if TestResources.ismcRNC():
            cmd = "fshascli -s /%s" % unit
            output = il_connections.execute_mml(cmd)
            wait_time = 0
            while ("role(ACTIVE)" not in output):
                time.sleep(5)
                output = il_connections.execute_mml(cmd)
                wait_time = wait_time + 5
                if (wait_time > max_wait):
                    raise AssertionError(
                        'unit %s did not get up in time (%d seconds)' %
                        max_wait)
        else:
            units = IpaMml.units_lib.get_units(unit, mode="")
            wait_time = 0
            print units
            while (units.state.find("-EX") == -1):
                time.sleep(5)
                units = IpaMml.units_lib.get_units(unit, mode="")
                wait_time = wait_time + 5
                if (wait_time > max_wait):
                    raise AssertionError('unit %s in state %s' %
                                         (unit, units.state))
Exemple #2
0
def Generic_Get_Rds_Link_Info(addr):
    cmd = "dmx_generic_stub get_rds_link_info " + addr
    output = connections.execute_mml(cmd)
    print output
    cmd += " >/tmp/generic.txt"
    connections.execute_mml(cmd)
    return
 def start_log_monitoring(self, unit = None):
     if TestResources.ismcRNC():
         il_connections.execute_mml('fsclish -c "set troubleshooting app-log rule rule-id default keep level info"')
         return LogMonitoringHandle()
     else:
         if unit is None:
             unit = TestResources.getResources('UNIT')
         return DMXLogMonitoringHandle(unit)
 def get_logs(self, handle=None):
     if handle is not None:
         return handle.get_logs()
     else:
         if TestResources.ismcRNC():
             il_connections.execute_mml('cat /var/log/syslog')
         else:
             computer_os_logs.get_computer_logs(TestResources.getResources('UNIT'))
 def get_logs(self, handle=None):
     if handle is not None:
         return handle.get_logs()
     else:
         if TestResources.ismcRNC():
             il_connections.execute_mml('cat /var/log/syslog')
         else:
             computer_os_logs.get_computer_logs(
                 TestResources.getResources('UNIT'))
 def start_log_monitoring(self, unit=None):
     if TestResources.ismcRNC():
         il_connections.execute_mml(
             'fsclish -c "set troubleshooting app-log rule rule-id default keep level info"'
         )
         return LogMonitoringHandle()
     else:
         if unit is None:
             unit = TestResources.getResources('UNIT')
         return DMXLogMonitoringHandle(unit)
 def start_log_monitoring_with_args(self, pattern=None, logfile='/var/log/syslog'):
     """
     Log monitoring with arguments
     """
     # Works only with mcrnc
     if TestResources.ismcRNC():
         il_connections.execute_mml('fsclish -c "set troubleshooting app-log rule rule-id default keep level info"')
         return LogMonitoringHandle(pattern, logfile)
     else:
         # In cRNC we cannot do any pattern based monitoring
         return self.start_log_monitoring()
 def __del__(self):
     if self.tail_pid != None:
         try:
             il_connections.execute_mml_without_check('kill %s' % self.tail_pid)
         except:
             pass
     if self.tmp_file != None:
         try:
             il_connections.execute_mml('rm -f %s' % self.tmp_file)
         except:
             pass
Exemple #9
0
def get_headers_from_monster_output_file(dir_name, file_name):
    """This keyword is to get the headers from monster output file
           
    | Parameters   | Man. | Description              |
    | output_dir   | Yes  | the directory name       |
    | output_file  | Yes  | the file name            |
    
    | Return value | a givaxi header(c5c5, multi x c6c6) |

    Example
    | ${header} | get_headers_from_monster_output_file |   monster_test | test.mgi |
    """
    #_file_should_exist(dir_name, file_name)
    output_givaxi_message = givaxi_message()
    temp_file = "givaxi_file_temp.mgi"
    command = "rm -f /var/log/%s/%s" % (dir_name, temp_file)
    connections.execute_mml_without_check(command)
    command = "cp -f /var/log/%s/%s /var/log/%s/%s" % (dir_name, file_name,
                                                       dir_name, temp_file)
    connections.execute_mml_without_check(command)
    #dump the c5c5 header
    header_items = _dump_header_content_according_header_length(
        dir_name, temp_file, "c5c5")
    output_givaxi_message.set_c5c5_header_from_file(header_items)
    header_length = str(
        int(output_givaxi_message.c5c5_header.header_t_length, 16))
    ##remove the c5c5 header from the file
    data_left = _remove_data_from_file(header_length, dir_name, temp_file)

    if (data_left == 1):
        c6c6_header_left = 1
    else:
        c6c6_header_left = 0

    while (c6c6_header_left == 1):
        header_items = _dump_header_content_according_header_length(
            dir_name, temp_file, "c6c6")
        c6c6_index = output_givaxi_message.set_c6c6_header_from_file(
            header_items)
        header_length = str(
            int(
                output_givaxi_message.c6c6_headers[c6c6_index].
                monheader_t_length, 16))
        ##remove the c6c6 header and data from the file
        data_left = _remove_data_from_file(header_length, dir_name, temp_file)
        if (data_left == 0):
            c6c6_header_left = 0

    output_givaxi_message.print_value()

    command = "rm -f /var/log/%s/%s" % (dir_name, temp_file)
    connections.execute_mml(command)

    return output_givaxi_message
 def __del__(self):
     if self.tail_pid != None:
         try:
             il_connections.execute_mml_without_check('kill %s' %
                                                      self.tail_pid)
         except:
             pass
     if self.tmp_file != None:
         try:
             il_connections.execute_mml('rm -f %s' % self.tmp_file)
         except:
             pass
    def stop_monitoring(self):

        il_connections.execute_mml_without_check('kill %%%s' % self.tail_job.strip('[]'))
        while True:
            if il_connections.execute_mml('jobs').find(self.tail_job) < 0:
                break
            time.sleep(1)

        self._get_log_data()
        self.running = False
        il_connections.execute_mml('rm -f %s' % self.tmp_file)
        self.tmp_file = None
        self.tail_pid = None
    def stop_monitoring(self):

        il_connections.execute_mml_without_check('kill %%%s' %
                                                 self.tail_job.strip('[]'))
        while True:
            if il_connections.execute_mml('jobs').find(self.tail_job) < 0:
                break
            time.sleep(1)

        self._get_log_data()
        self.running = False
        il_connections.execute_mml('rm -f %s' % self.tmp_file)
        self.tmp_file = None
        self.tail_pid = None
Exemple #13
0
def Get_Last_Line_Number(log_file, pid):

    cmd = "kill -USR1 %s" % pid
    connections.execute_mml(cmd)
    time.sleep(0.5)

    cmd = "cat %s" % log_file
    logcontent = connections.execute_mml(cmd)

    re_item = '(?<=Totally have received )\d*'
    numlist = re.findall(re_item, logcontent)

    if numlist is not None:
        output = numlist[len(numlist) - 1]
    return output
Exemple #14
0
def Get_Last_Queue_Limit(log_file, pid):

    cmd = "kill -USR2 %s" % pid
    connections.execute_mml(cmd)
    time.sleep(0.5)

    cmd = "cat %s" % log_file
    logcontent = connections.execute_mml(cmd)

    re_item = '(?<=Queue limit:)\d*'
    queue_limit = re.findall(re_item, logcontent)

    if queue_limit is not None:
        output = queue_limit[len(queue_limit) - 1]
    return output
 def start_log_monitoring_with_args(self,
                                    pattern=None,
                                    logfile='/var/log/syslog'):
     """
     Log monitoring with arguments
     """
     # Works only with mcrnc
     if TestResources.ismcRNC():
         il_connections.execute_mml(
             'fsclish -c "set troubleshooting app-log rule rule-id default keep level info"'
         )
         return LogMonitoringHandle(pattern, logfile)
     else:
         # In cRNC we cannot do any pattern based monitoring
         return self.start_log_monitoring()
 def run_cmd(self, cmd, ext=''):
     """
     Excecute a CLI command in mcRNC
     """
     exec_cmd = cmd + " " + ext
     result = il_connections.execute_mml(exec_cmd)
     return result
Exemple #17
0
def Get_Last_Queue_Msgs(log_file, pid):

    cmd = "kill -USR2 %s" % pid
    connections.execute_mml(cmd)
    time.sleep(0.5)

    cmd = "cat %s" % log_file
    logcontent = connections.execute_mml(cmd)

    re_item = '(?<=msgs:)\s*\d*'
    queue_msgs = re.findall(re_item, logcontent)

    print "queue_msgs is: %d" % (len(queue_msgs))
    if queue_msgs is not None:
        output = queue_msgs[len(queue_msgs) - 1]
    return output
Exemple #18
0
def list_name_of_name_server(service_name):
    """This keyword is to get the service pid by the service name

    #COMMAND: nasext ls service_name

    | Parameters | Man. | Description |
    | service_name      | Yes  | The name of the service
    | Return value |call detail information (CommonItem)

    Example
    | Get Service Pid Of Name Server | test_service |

    """
    command = "nasext ls " + service_name
    output = connections.execute_mml(command)

    item = """Service_Name:([a-zA-Z0-9\-_]+)"""
    match = re.search(item, output)

    if match is not None:
        service_pid = CommonItem()
        service_pid.Name = match.group(1)
        return service_pid
    else:
        exceptions.raise_ILError("ILCommandExecuteError", output)
 def run_cmd(self, cmd, ext = ''):
     """
     Excecute a CLI command in mcRNC
     """
     exec_cmd = cmd + " " + ext
     result = il_connections.execute_mml(exec_cmd)
     return result
Exemple #20
0
def check_all_MO_between_LDAP_and_CAC():
    """
     This keyword is used to check all MO difference between CAC and LDAP.

    #COMMAND: iltrmcli -C -m

    | Parameters | Man.| Description       |
    |            | No  |      |

    | Return value | an instance of CommonItem |

    Example
    | result | list all conn resource info | true | 
    """
    command = "iltrmcli -C -m"
    print "Command:", command
    exec_output = connections.execute_mml(command)
    #if (-1 != exec_output.find("No Difference")):
	#pattern = re.compile("""(\S+)\s+No Difference\s+""", re.DOTALL)
	#items = pattern.findall(exec_output)
	#if len(items) == 4:
      #      return "No Difference"
       # else:
       #     return _parse_sync_compare(exec_output)
    #else:
    return _parse_sync_compare(exec_output)
Exemple #21
0
def inquiry_udp_conn_port_info(ip_address, port_num, vrf_id='', filter_str = 'true'):    
    """
     This keyword is used to inquiry specified UDP connection resource in CACPRB

    #COMMAND: iltrmcli -S -u 192.168.1.1:1024

    | Parameters | Man.| Description       |
    | ip_addr    | Yes | IP address        |
    | port_num   | Yes | UDP Port ID       |
    | vrf_id     | No  | Instance ID of virtual routing forward |
    | filter     | No  | Filter whether add the reserved, free, buffer port info into the list |

    | Return value | an instance of CommonItem |

    Example
    | result | inquiry udp conn resource info | ${IP_address} | ${UDP_PORT} |
    """
    
    command = "iltrmcli -S -u %s:%s " % (ip_address, port_num)
    if vrf_id != '' and connections.execute_mml('echo $HW_PLATFORM').count('FTLB') == 0:
        command = command + ' -v %s' % (vrf_id)
    print "Command:", command
    exec_output = connections.execute_mml_without_check(command)
    if filter_str.upper() == 'TRUE':
        filter_enable=True
    else:
    	filter_enable=False
    return _parse_conn_info_udp(exec_output, filter_enable)
Exemple #22
0
def get_processor_index_by_node_name(input_unit_name):
    """This function used to get unit type by input unit name.
      If success retuen the correct pid, else return 0xffff
	   | Parameters      | Man. | Description                                  |
	   | input_unit_name | Yes  | unit name                                    |
   """
    cmd = 'ilclifunit -u'
    input_string = connections.execute_mml(cmd)

    if len(input_string) == 0:
        return int("ffff", 16)

    input_string = input_string.strip()
    input_string = input_string.splitlines()

    count = len(input_string)
    i = 3
    while i < count:
        if input_string[i] != "":
            #print input_string[i]
            unit_name = get_mo_name(input_string[i])
            if unit_name == input_unit_name:
                unit_pid = get_pindex_from_phys_addr(input_string[i])
                #print 'unit:%s==%s' %(unit_name, unit_pid)
                return int(unit_pid, 16)
            i += 1
        else:
            return int("ffff", 16)

    return int("ffff", 16)
Exemple #23
0
def opt_service_of_name_server(opt_type, list):
    """This keyword is to add, update, remove or pending request service of name server.

    #COMMAND: nasext

    | Parameters | Man. | Description |
    | opt_type    | yes  |'add','remove','update' or 'pending_req'
    | list       | Yes  | Service Info List:server_name,computer,family,process_id,focus,group_service,local_service,replaceable,group_number,delivery,attr |

    | Return value | The result of the operation. |

    Example
    | Opt Service Of Name Server | 'add' | ['test_server','4002','123','0','0','0','0','0','0','0','0']
    | Opt Service Of Name Server | 'update' | ['test_server','4002','123','0','0','0','0','0','0','0','0']
    """
    opt_dict = {'add': ['Add ok',11,'a'],\
               'remove': ['Remove ok',5,'r'],\
               'update': ['Update ok',11,'u'],\
               'pending_req':['',1,'p']
              }
    list = list[:opt_dict[opt_type][1]]
    expect_result = opt_dict[opt_type][0]
    command = ",".join(list)
    command = "nasext " + opt_dict[opt_type][2] + " " + command

    if opt_type == 'pending_req':
        command = command + ',100,1 >' + result_file + '&'
    output = connections.execute_mml(command)
    if output.count(expect_result) != 0:
        return True
    return False
Exemple #24
0
def Get_Last_Stat_Size(log_file, pid):
    cmd = "kill -USR1 %s" % pid
    connections.execute_mml(cmd)
    time.sleep(0.5)

    cmd = "kill -INT %s" % pid
    connections.execute_mml(cmd)
    time.sleep(0.5)

    cmd = "cat %s" % log_file
    logcontent = connections.execute_mml(cmd)
    print "logcontent is: %s" % logcontent
    re_item = '(?<=Buffers in queue:)\d*'

    queue_buffer = re.findall(re_item, logcontent)

    if queue_buffer is not None:
        output = queue_buffer[len(queue_buffer) - 1]
    return output
Exemple #25
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
 def __init__(self, pattern=None, log_file='/var/log/syslog'):
     self.log = None
     self.tmp_file = '/tmp/foo_test_logs_%d.txt' % random.randint(0, 999999)
     cmd = 'tail -n 0 -F %s' % log_file
     if pattern != None:
         cmd += ' | grep --line-buffered "%s" ' % pattern
     cmd += ' > %s &' % self.tmp_file
     out = il_connections.execute_mml(cmd)
     #print out.split('\n')
     self.tail_job = out.split('\n')[1].split()[0]
     self.tail_pid = out.split('\n')[1].split()[1]
     self.running = True
     self.log_items = []
 def _get_log_data(self):
     if self.running:
         # Still running
         logs = il_connections.execute_mml('cat %s' % self.tmp_file).split('\n')
         # Remove all empty lines
         for i, l in enumerate(logs):
             logs[i] = l.strip()
         #print 'Old items', self.log_items
         #print l
         # And extend the log items list with all new items
         self._update_log_data(logs)
         # print 'after extend',self.log_items
     return self.log_items
 def __init__(self, pattern = None, log_file = '/var/log/syslog'):
     self.log = None
     self.tmp_file = '/tmp/foo_test_logs_%d.txt' % random.randint(0,999999)
     cmd = 'tail -n 0 -F %s' % log_file
     if pattern != None:
         cmd += ' | grep --line-buffered "%s" ' % pattern
     cmd += ' > %s &' % self.tmp_file
     out = il_connections.execute_mml(cmd)
     #print out.split('\n')
     self.tail_job = out.split('\n')[1].split()[0]
     self.tail_pid = out.split('\n')[1].split()[1]
     self.running = True
     self.log_items = []
Exemple #29
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
 def _get_log_data(self):
     if self.running:
         # Still running
         logs = il_connections.execute_mml('cat %s' %
                                           self.tmp_file).split('\n')
         # Remove all empty lines
         for i, l in enumerate(logs):
             logs[i] = l.strip()
         #print 'Old items', self.log_items
         #print l
         # And extend the log items list with all new items
         self._update_log_data(logs)
         # print 'after extend',self.log_items
     return self.log_items
    def wait_unit_up(self, unit="", max_wait=480):
        if unit == "":
            unit = TestResources.getResources('UNIT')

        if TestResources.ismcRNC():
            cmd = "fshascli -s /%s" % unit
            output = il_connections.execute_mml(cmd)
            wait_time = 0
            while("role(ACTIVE)" not in output):
                time.sleep(5)
                output = il_connections.execute_mml(cmd)
                wait_time = wait_time + 5
                if(wait_time > max_wait):
                    raise AssertionError('unit %s did not get up in time (%d seconds)' % max_wait)
        else:
            units = IpaMml.units_lib.get_units(unit, mode="")
            wait_time = 0
            print units
            while(units.state.find("-EX") == -1):
                time.sleep(5)
                units = IpaMml.units_lib.get_units(unit, mode="")
                wait_time = wait_time + 5
                if(wait_time > max_wait):
                    raise AssertionError('unit %s in state %s' % (unit, units.state))
Exemple #32
0
def copy_file(file1, file2):
    """This keyword is to copy file1 to file2 us cp command

    #COMMAND: cp

    | Parameters | Man. | Description |
    | file1   | Yes | source file name
    | file2   | Yes | destination name

    | Return value | Successful: True, Failure: False |

    Example
    | ${result} | copy_file | test.txt | test.bak |
    | Should Be True | ${result} |

    """
    #just copying file/folder but not symbol links
    command = "cp -rfL %s %s" % (file1, file2)
    out = connections.execute_mml_without_check(command, 'y')
    if out.count("Read-only file system") != 0:
        connections.execute_mml("mount -o rw,remount /mnt/sysimg")
        connections.execute_cli(command, 'y')

    return True
Exemple #33
0
def kill_process_by_pid_with_option(pid):
    """ This keyword to kill give process with -2 option by pid

    #COMMAND: kill

    | Parameters  | Man. | Description  |
    | pid         | Yes  | process id |

    | Return value | No return value |

    Example
    | ${result}  |  Kill Process By PID With Option| 4321  |

    """
    command = "kill -2 " + pid
    out = connections.execute_mml(command)
Exemple #34
0
def check_alarm_of_name_server(file_name):
    """This keyword is to add service of name server.

    #COMMAND: cat file_name

    | Parameters | Man. | Description |
    | file_name       | Yes  | The alarm file
    | Return value | name server alarm exists in the file or not |

    Example
    | Check Alarm Of Name Server | test.txt |

    """
    command = "cat " + file_name
    output = connections.execute_mml(command)

    if output.count('SP=13') == 0:
        exceptions.raise_ILError("ILCommandExecuteError", output)
Exemple #35
0
def list_content_of_name_server(service_name):
    """This keyword is to get the service pid by the service name

    #COMMAND: nasext g service_name

    | Parameters | Man. | Description |
    | service_name      | Yes  | The name of the service
    | Return value |call detail information (CommonItem)
     can support the following attributes:
         *service_pid.Computer
         *service_pid.Family
         *service_pid.Process
         *service_pid.Focus
         *service_pid.Group
         *service_pid.Delivery
         *service_pid.Attr

    Example
    | Get Service Pid Of Name Server | test_service |

    """
    command = "nasext lc " + service_name
    output = connections.execute_mml(command)

    item = 'Index\s*:\s*(\d+)\w+\s+Service name  :\s*([a-zA-Z0-9\-_]+)\s*Real location :\s*(\d+)\s*Computer      :\s*(\w+)\s*Family        :\s*(\d+)\s*Process Id    :\s*(\d+)\s*Focus         :\s*(\d+)\s*Group service :\s*(\d+)\s*Local service :\s*(\d+)\s*Replaceable   :\s*(\d+)\s*Msg group     :\s*(\d+)\s*Delivery      :\s*(\d+)\s*Attributes    :\s*(\d+)\s*Number of use :\s*(\d+)\s*Token         :\s*(\d+)\s*In use        :\s*(\d+)\s*Can show      :\s*(\d+)'
    match = re.search(item, output)
    print match
    if match is not None:
        service_pid = CommonItem()
        service_pid.Name = match.group(2)
        service_pid.Computer = match.group(4)
        service_pid.Family = match.group(5)
        service_pid.Process = match.group(6)
        service_pid.Focus = match.group(7)
        service_pid.Group = match.group(8)
        service_pid.Local = match.group(9)
        service_pid.Replace = match.group(10)
        service_pid.GroupNum = match.group(11)
        service_pid.Delivery = match.group(12)
        service_pid.Attr = match.group(13)
        return service_pid
    else:
        exceptions.raise_ILError("ILCommandExecuteError", output)
Exemple #36
0
def send_pending_request_of_name_service(service_name,
                                         family_id='9999',
                                         timeout='100',
                                         sync='0'):
    """This keyword is to send pending request service of name server.

    #COMMAND: nasext

    | Parameters      | Man. | Description |
    | service_name    | yes  | name of service user want to request |
    | family_id       | No   | Family id of the PRB registration pending service |
    | timeout         | No   | Timer for the pending request.Default hex |
    | sync            | No   | Synchronized or asynchronized waiting method for request service  |

    | Return value | The result of the operation. |

    """
    command = 'nasext -f ' + family_id + ' p ' + service_name + ',' + timeout + ',' + sync + ' >' + result_file + '&'
    output = connections.execute_mml(command)
    return output.strip().split()[-1]
Exemple #37
0
def list_service_pid_of_name_server(service_name):
    """This keyword is to list the service PID of the speceified serivce name

    #COMMAND: nasext lp service_name

    | Parameters | Man. | Description |
    | service_name      | Yes  | The name of the service

    | Return value |call detail information (CommonItem)
     can support the following attributes:
         *service_pid.Computer
         *service_pid.Family
         *service_pid.Process
         *service_pid.Focus
         *service_pid.Group
         *service_pid.Delivery
         *service_pid.Attr

    Example
    | List Service Pid Of Name Server | test_service |

    """
    command = "nasext lp " + service_name
    output = connections.execute_mml(command)
    item = '\s*Computer\s*:\s*(\w+)\s*Family\s*:\s*(\w+)\s*Process\s*Id\s*:\s*(\w+)\s*Focus\s*:\s*(\w+)\s*Group\s*number\s*:\s*(\w+)\s*Delivery\s*:\s*(\w+)\s*Attr\s*:\s*(\w+)\s*'
    items = re.findall(item, output)
    if items is None:
        exceptions.raise_ILError("ILCommandExecuteError", output)

    result = []
    for item in items:
        service_pid = CommonItem()
        service_pid.Computer = item[0]
        service_pid.Family = item[1]
        service_pid.Process = item[2]
        service_pid.Focus = item[3]
        service_pid.Group = item[4]
        service_pid.Delivery = item[5]
        service_pid.Attr = item[6]
        result.append(service_pid)
    return result
Exemple #38
0
def get_dmxmsg_statistic():
    """This keyword is to get dmxmsg statistic info
    """

    cmd = 'cat /proc/dmxmsg/statistics'
    output = connections.execute_mml(cmd)

    statistic_list = CommonItem()

    re_item = '\s*[a-z\s.]+\s*(\d+)\s*'
    m = re.findall(re_item, output)

    if m is not None:
        statistic_list.discarded_msgs = m[9]
        statistic_list.discarded_sync_msgs_mismatch = m[10]
        statistic_list.discarded_sync_msgs_queue_full = m[11]
        statistic_list.discarded_reorder_msgs = m[13]
        statistic_list.discarded_timeout_sync_msgs = m[12]
        statistic_list.discarded_timeout_reorder_msgs = m[14]
        statistic_list.discarded_sync_msgs_unexpected = m[16]
    return statistic_list
Exemple #39
0
def get_pending_result_of_name_server():
    """This keyword is to get the pending request result from the result file

    #COMMAND: cat file

    | Parameters | Man. | Description |

    | Return value |call detail information (CommonItem)
     can support the following attributes:
         *service_pid.Computer
         *service_pid.Family
         *service_pid.Process
         *service_pid.Focus
         *service_pid.Group
         *service_pid.Delivery
         *service_pid.Attr

    Example
    |${result}  | Get Pending Result Of Name Server |

    """
    command = 'cat ' + result_file
    output = connections.execute_mml(command)

    item = '\s*Computer\s*:\s*(\w+)\s*Family\s*:\s*(\w+)\s*Process\s*id\s*:\s*(\w+)\s*Focus\s*:\s*(\w+)\s*Group\s*:\s*(\w+)\s*Delivery\s*:\s*(\w+)\s*Attr\s*:\s*(\w+)\s*'
    match = re.search(item, output)
    if match is not None:
        service_pid = CommonItem()
        service_pid.Computer = match.group(1)
        service_pid.Family = match.group(2)
        service_pid.Process = match.group(3)
        service_pid.Focus = match.group(4)
        service_pid.Group = match.group(5)
        service_pid.Delivery = match.group(6)
        service_pid.Attr = match.group(7)
        return service_pid
    else:
        exceptions.raise_ILError("ILCommandExecuteError", output)
 def start_profiling_mc(self):
     il_connections.execute_mml('opcontrol --start --session-dir=%s' % PROFILE_SESSION_DIR)
 def init_profiling_mc(self):
     il_connections.execute_mml('opcontrol --init')
     il_connections.execute_mml('opcontrol --reset')
     il_connections.execute_mml('opcontrol --no-vmlinux')
     il_connections.execute_mml('opcontrol --session-dir=%s' % PROFILE_SESSION_DIR)
 def stop_profiling_mc(self):
     il_connections.execute_mml('opcontrol --dump')
    def get_profiling_result_mc(self):
        il_connections.execute_mml('cd %s;opreport -l --sort=image --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,PAB_BIN))
        il_connections.execute_mml('cd %s;opreport -l --sort=image --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,RAY_BIN))
        il_connections.execute_mml('cd %s;opreport -l --sort=image --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,FOO_BIN))
        il_connections.execute_mml('cd %s;opgprof --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,PAB_BIN))
        il_connections.execute_mml('cd %s;opgprof --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,RAY_BIN))
        il_connections.execute_mml('cd %s;opgprof --session-dir=%s %s || true' % (WORK_DIR,PROFILE_SESSION_DIR,FOO_BIN))
        out =  il_connections.execute_mml('gprof -p %s || true' % PAB_BIN)
        out = out + il_connections.execute_mml('gprof -p %s || true' % RAY_BIN)
        out = out + il_connections.execute_mml('gprof -p %s || true' % FOO_BIN)

        il_connections.execute_mml('opcontrol --stop')
        il_connections.execute_mml('opcontrol --shutdown')

        return out