Esempio n. 1
0
def compressed_files_can_be_unzipped_successfully(dir_name, files_name):
    """This keyword is to unzip the compressed files using gzip
           
    | Parameters   | Man. | Description              |
    | dir_name   | Yes  | the directory name       |
    | files_name  | Yes  | the array of files name            |
    
    | Return value | new_files_name |

    Example
    | compressed files can be unzipped successfully |   monster_test | ["test0.gz","test1.gz"] |
    """
    error_log = "not in gzip format"
    new_files_name = []
    files_len = len(files_name)
    for i in range(files_len):
        _file_should_exist(dir_name, files_name[i])
        command = "gzip -l /var/log/%s/%s" % (dir_name, files_name[i])
        output = connections.execute_mml_without_check(command)
        if (output.count(error_log) > 0):
            exceptions.raise_ILError(
                "ILCommandExecuteError",
                "The compressed file can not be unzipped.")
        command = "gzip -d -f /var/log/%s/%s" % (dir_name, files_name[i])
        output = connections.execute_mml_without_check(command)
        if (output.count(error_log) > 0):
            exceptions.raise_ILError(
                "ILCommandExecuteError",
                "The compressed file can not be unzipped.")
        new_files_name.append(files_name[i].replace('.gz', ''))
    return new_files_name
Esempio n. 2
0
def message_count_is_correct_in_the_monitored_files(dir_name, files_name,
                                                    total_message_count):
    """This keyword is to use readste to check the message count is correct for the monitored files.
    | Parameters   | Man. | Description              |
    | output_dir   | Yes  | the directory name       |
    | output_files  | Yes  | the array of files name            |
    | total_message_count   | Yes  | total message count         |
    
    | Return value | None |
    
    Example
    | message count is correct in the monitored files |   monster_test | ["test1","test2"] | 300 |
    """
    files_name_len = len(files_name)
    check_message_count = 0
    for i in range(files_name_len):
        _file_should_exist(dir_name, files_name[i])
        file_name = "/var/log/%s/%s" % (dir_name, files_name[i])
        command = "readste -i %s -a summary" % (file_name)
        output = connections.execute_mml_without_check(command)
        result_list = output.splitlines()
        result_list_len = len(result_list)
        for i in range(result_list_len):
            if result_list[i].count('message frames'):
                check_message_count = check_message_count + int(
                    result_list[i].split()[0])
    print 'Total message count in files is: %s.' % (str(check_message_count))
    if (check_message_count <> int(total_message_count)):
        exceptions.raise_ILError(
            "ILCommandExecuteError",
            "The monitored message count is not correct.")
Esempio n. 3
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)
Esempio n. 4
0
def check_bottom_values(msg_buf,omu_phy_addr, omu_logical_address='7002'):
    """This keyword is to check decoded msg bottom vlaues
    
    | Parameters   | Man. | Description            |
    | msg_buf      | Yes  | The decoded msg values |

    | Return value | success, if the bottom values are correct    |
 
    Example
    | result | check bottom values | ${msg_buf} |
    """

    if (msg_buf.find("Bottom:") == -1):
       exceptions.raise_ILError("ILCommandExecuteError", "failed to get msg bottom")
       
    msg_list = []
    msg_buf = msg_buf[msg_buf.find("time of day (dword):"):]
    msg_text = msg_buf.split("Bottom:")
  
    for msg in msg_text:
        print msg
        match = re.search(r"control \(byte\):\s*([0-9]*)", msg, re.I)
        msg_info = CommonItem()
        msg_info.control = match.group(1)
        match = re.search(r"hop_count \(byte\):\s*([0-9]*)\s*", msg, re.I)
        msg_info.hop = match.group(1)
        match = re.search(r"\s*msg number \(word\):\s*([0-9]*)\s*", msg, re.I)
        msg_info.msgnum = match.group(1)
        match = re.search(r"\s*next phys computer \(word\):\s*([0-9]*)\s*", msg, re.I)
        msg_info.nextcomp = match.group(1)
        match = re.search(r"\s*computer_addr \(word\):\s*([0-9]*)\s*", msg, re.I)
        msg_info.comp = match.group(1)
        match = re.search(r"\s*phys_computer \(word\):\s*([0-9]*)\s*", msg, re.I)
        msg_info.phycomp = match.group(1)
        msg_list.append(msg_info)
    print msg_list
    omu_phy_addr = omu_phy_addr.split('X')[1]
    omu_phy_addr = atoi(omu_phy_addr,16)
    omu_logical_address = atoi(omu_logical_address,16)
    result = misc.select_entries_from_list(msg_list,'msgnum=9901')
    for msg in result:
        msg.nextcomp = atoi(msg.nextcomp,16)
        msg.phycomp = atoi(msg.phycomp,16)
        msg.comp = atoi(msg.comp,16)
        if ( msg.control <> '08' ) or (msg.hop <> '01') or (msg.comp <> omu_logical_address) or ((msg.nextcomp <> omu_phy_addr) and (msg.nextcomp <> omu_logical_address)) or ((msg.phycomp <> omu_phy_addr) and (msg.phycomp <> omu_logical_address)):
            return 'failure'
    result = misc.select_entries_from_list(msg_list,'msgnum=6034')
    for msg in result:
        msg.comp = atoi(msg.comp,16)
        msg.nextcomp = atoi(msg.nextcomp,16)
        msg.phycomp = atoi(msg.phycomp,16)
        if ( msg.control <> '80' and msg.control <> '00' and msg.control <> '08' ) or (msg.hop <> '04' and msg.hop <> '01') or (msg.comp <> omu_phy_addr) or (msg.nextcomp <> omu_phy_addr) or (msg.phycomp <> omu_phy_addr):
            return 'failure'
        if msg.control == '80' and msg.hop <> '04':
            return 'failure'
        if msg.control == '00' and msg.hop <> '01':
            return 'failure'
        if msg.control == '08' and msg.hop <> '01':
            return 'failure'
    return 'success'
Esempio n. 5
0
def select_random_IP_address_and_recovery_group_ADA(ip_addr_num_str):
    """    
    This keyword is used to select ip addresses randomly in ADA environment
    #COMMAND: fsclish -c "show networking instance default address"
    | Parameters          | Man. | Description                                 |
    | ip_addr_num_str     | Yes  | the number of IP addresses which needed     |

     | Return value | an Instance of list with common item element instance |

    Example
    | result | select_random_IP_address_and_recovery_group | 5 |
    """
    eitp_ip_pool = []
    ip_addr_num = atoi(ip_addr_num_str)

    eitp_ip_list = _get_available_ip_with_sepcified_recovery_group_type('GFCP')
    for list_item in eitp_ip_list:
        eitp_ip_pool.extend(list_item)

    if len(eitp_ip_pool) < ip_addr_num:
        exceptions.raise_ILError("ILOutputParseError",
                                 "Not enough IP Address with requirement")

    random.shuffle(eitp_ip_pool)
    return eitp_ip_pool[0:ip_addr_num]
Esempio n. 6
0
def select_different_IP_address_in_different_recovery_group(ip_addr_num_str):
    """    
    This keyword is used to select ip addresses from different recovery groups randomly
    #COMMAND: fsclish -c "show networking instance default address"
    | Parameters          | Man. | Description                                 |
    | ip_addr_num_str     | Yes  | the number of IP addresses which needed     |

    | Return value | an Instance of list with common item element instance |

    Example
    | result | select_different_IP_address_in_different_recovery_group | 5 |
    """

    eitp_ip_list = _get_available_ip_with_sepcified_recovery_group_type('QNUP')
    ip_addr_num = atoi(ip_addr_num_str)

    if len(eitp_ip_list) < ip_addr_num:
        exceptions.raise_ILError(
            "ILOutputParseError",
            "Not enough QNUP to provide IP Address with requirement")

    random.shuffle(eitp_ip_list)
    temp_eitp_ip_list = []
    for info in eitp_ip_list[0:ip_addr_num]:
        random.shuffle(info)
        temp_eitp_ip_list.append(info[0])
    return temp_eitp_ip_list
Esempio n. 7
0
def nice_value_should_be_correct(top_nice_values, nice_value):
    result = 0
    nice_values_len = len(top_nice_values)
    for i in range(nice_values_len):
        if (top_nice_values[i] == nice_value):
            result = 1
    if (result == 0):
        exceptions.raise_ILError("ILCommandExecuteError",
                                 "The nice value is not correct.")
Esempio n. 8
0
def monster_should_start_failed_with_invalid_nice_value(invalid_nice_value):
    #Error: invalid -P parameter, the nice value should be in range [-20, 19]
    command = 'monster -P %s' % (invalid_nice_value)
    out = connections.execute_mml_without_check(command)
    result_list = out.splitlines()
    result_list_len = len(result_list)
    for i in range(result_list_len):
        print result_list[i]
        if result_list[i].count(
                'Error: invalid -P parameter, the nice value should be valid'
        ) > 0:
            result = result_list[i]
            return result
    exceptions.raise_ILError(
        "ILCommandExecuteError",
        "The error output is not found for invalid nice value.")
Esempio n. 9
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)
Esempio n. 10
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)
Esempio n. 11
0
def _file_should_exist(dir_name, file_name):
    """This keyword is to check if the file exists
           
    | Parameters   | Man. | Description              |
    | dir_name     | Yes  | the directory name       |
    | file_name    | Yes  | the file name            |
    
    | Return value | file_length |
    
    """
    file_length = 0
    command = "ll /var/log/%s/%s" % (dir_name, file_name)
    out = connections.execute_cli(command)
    if (out.count('No such file or directory') > 0):
        exceptions.raise_ILError("ILCommandExecuteError",
                                 "The compressed file is not saved.")
    else:
        file_length = out.split()[4]
    print file_length
    return file_length
Esempio n. 12
0
def show_ip_address(ipaddress):
    """
    This keyword is used to show the ip address in SCLI
    
    #COMMAND: fsclish -c "show show networking address ip-address <ip_addr>"

    | Parameters   | Man. | Description       |
    | ipaddress    | Yes  | IP address        |


    | Return value | command execution result |

    Example
    | result | show_ip_address  | 12.0.0.1 |
    """
    command = """fsclish -c "show networking address ip-address %s" """ % (
        ipaddress)
    print "Command: " + command
    output = connections.execute_mml_without_check(command)

    if output == "" or output == " ":
        exceptions.raise_ILError("ILCommandExecuteError",
                                 "ip address infomation doesn't exist")
    if output.find("type") != -1:
        pattern = re.compile(
            """\s+IP addresses in\s+\S+\s+instance:\s+(?P<inface>\S+)\s+type\s+:\s+(?P<type>\S+)\s+address\s+:\s+(?P<address>\S+)\s+owner\s+:\s+(?P<owner>\S+)\s+$"""
        )
    else:
        pattern = re.compile(
            """\s+IP addresses in\s+\S+\s+instance:\s+(?P<inface>\S+)\s+address\s+:\s+(?P<address>\S+)\s+owner\s+:\s+(?P<owner>\S+)\s+$"""
        )
    match = re.match(pattern, output)

    if match:
        return match.groupdict()
    else:
        print "not match"
        exceptions.raise_ILError("ILCommandExecuteError",
                                 "ip address infomation doesn't exist")

    return {}
Esempio n. 13
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
Esempio n. 14
0
def check_bin_header_is_correct(dir_name, files_name):
    """This keyword is to check whether the LIBGEN bin header is correct or not.
    | Parameters   | Man. | Description              |
    | dir_name     | Yes  | the directory name       |
    | files_name   | Yes  | the array of files name  |
    
    | Return value | None |
    
    Example
    | check bin header is correct | monster_test | ["test1-000.bin","test1-001.bin"] | 
    """
    bin_header_context = "0000000 0000 000c 0003 0000 0000 0000"
    file_count = len(files_name)
    for i in range(file_count):
        command = "hexdump -n 16 /var/log/" + dir_name + "/" + files_name[i]
        output = connections.execute_mml_without_check(command)
        if (output.count(bin_header_context) <= 0):
            exceptions.raise_ILError(
                "ILCommandExecuteError",
                "The LIBGEN bin header is not correct for file: %s." %
                files_name[i])
Esempio n. 15
0
def select_different_IP_address_in_same_recovery_group(ip_addr_num_str):
    """    
    This keyword is used to select ip addresses from same recovery group randomly
    #COMMAND: fsclish -c "show networking instance default address"
    | Parameters          | Man. | Description                                 |
    | ip_addr_num_str     | Yes  | the number of IP addresses which needed     |

    | Return value | an Instance of list with common item element instance |

    Example
    | result | select_different_IP_address_in_same_recovery_group | 5 |
    """
    eitp_ip_list = _get_available_ip_with_sepcified_recovery_group_type('QNUP')
    ip_addr_num = atoi(ip_addr_num_str)
    random.shuffle(eitp_ip_list)
    for list_item in eitp_ip_list:
        if len(list_item) < ip_addr_num:
            continue
        random.shuffle(list_item)
        return list_item[0:ip_addr_num]
    exceptions.raise_ILError("ILOutputParseError",
                             "Not enough IP Address with requirement")
Esempio n. 16
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)
Esempio n. 17
0
def get_service_pid_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 g " + 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*:\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)
Esempio n. 18
0
 def check_value(self, message_type, version):
     if (self.header_t_identifier <> "c5c5"):
         exceptions.raise_ILError("ILCommandExecuteError",
                                  "The header_t_identifier is not c5c5.")
     if (self.header_t_message_type <> message_type):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The header_t_message_type is not %s." % message_type)
     if (self.header_t_version <> version):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The header_t_version is not %s." % version)
Esempio n. 19
0
def messages_can_be_read_successfully_from_file(dir_name,
                                                files_name,
                                                test_prb,
                                                message_number,
                                                total_message_count,
                                                header_only='0'):
    """This keyword is to use readste to read the monitored files and check message prb, message number, total message count is correct.
    | Parameters   | Man. | Description              |
    | dir_name     | Yes  | the directory name       |
    | files_name   | Yes  | the array of files name  |
    | test_prb     | Yes  | test prb number          |
    | message_number  | Yes  | message number        |
    | total_message_count   | Yes  | total message count         |
    
    | Return value | None |
    
    Example
    | message can be read successfully from file |   monster_test | ["test1","test2"] | C385 | 8000 | 10 |
    """
    files_name_len = len(files_name)
    check_test_prb = 0
    check_message_number = 0
    check_message_count = 0
    test_prb = test_prb[2:6]
    received_test_prb = "RECEIVED BY: %s" % (test_prb)
    for i in range(files_name_len):
        file_name = files_name[i]
        _file_should_exist(dir_name, file_name)
        file_name = "/var/log/%s/%s" % (dir_name, file_name)
        if (header_only == '1'):
            command = "readste -H -i %s" % (file_name)
        else:
            command = "readste -i %s" % (file_name)
        output = connections.execute_mml_without_check(command)
        l = get_msg_from_buf(output)
        msg_list = [parse_msg(i) for i in l]
        for msg in msg_list:
            if msg['recv']['computer'] <> int(test_prb, 16):
                print msg['recv']['computer'], int(test_prb, 16)
                exceptions.raise_ILError(
                    "ILCommandExecuteError",
                    "The monitored message family is not %s." % test_prb)
            if msg['msg']['number'] <> int(message_number, 16):
                print msg['msg']['number'], int(message_number, 16)
                exceptions.raise_ILError(
                    "ILCommandExecuteError",
                    "The monitored message number is not %s." % message_number)
        check_message_count = check_message_count + len(msg_list)
        print 'msg count: ', check_message_count
    if (check_message_count <> int(total_message_count)):
        exceptions.raise_ILError(
            "ILCommandExecuteError",
            "The total message count is not %s." % total_message_count)
Esempio n. 20
0
def release_iub_leg(call_id, leg_id="IN", computer="USCP-0"):
    """
     This keyword is used to release iub leg
     
    #COMMAND: lgutilgx RV:<computer>:<call_id>:<leg_id>

    | Parameters | Man.| Description       |
    | call_id    | Yes | call ID           |
    | leg_id     | No  | Leg ID            |
    | computer   | No  | recovery unit where the leg reserved, default is USCP-0 |

    | Return value | an instance of CommonItem |

    Example
    | result | release_iub_leg | ${CALL_ID} | ${LEG_ID}| ${USCP-0} |
    """
    command = """lgutilgx RV:%s:%s:%s"""  % (computer, call_id, leg_id)
    exec_output = connections.execute_mml_without_check(command)
    if -1 == exec_output.find("RELEASING SUCCESSFUL"):
        raise exceptions.raise_ILError("ILCommandExecuteError", exec_output)
    return "success"
Esempio n. 21
0
def release_iucs_leg(call_id, computer="USCP-0"):
    """
     This keyword is used to release iucs leg
     
    # COMMAND: lgutilgx RV:USCP-0:123:OUT

    | Parameters | Man.| Description       |
    | call_id    | Yes | IPBR ID           |
    | computer   | No  | recovery unit where the leg reserved, default is USCP-0 |

    | Return value | string "success" when the operation success |

    Example
    | result | release_iucs_leg | ${CALL_ID} | ${USCP-0} |
    """
    command = """lgutilgx RV:%s:%s:OUT""" %(computer, call_id)
    print "execute command:", command
    exec_output = connections.execute_mml_without_check(command)
    if -1 == exec_output.find("RELEASING SUCCESSFUL"):
        raise exceptions.raise_ILError("ILCommandExecuteError", exec_output)
    return "success"
Esempio n. 22
0
def release_specfied_call(call_id, computer, hand_id, focus_id):
    """
     This keyword is used to release specified call with rm2prb hand's hand id and focus id
     
    #COMMAND: lgutilgx RID:CSPU-0:123,OUT; lgutilgx RID:CSPU-0:123,IN-01

    | Parameters | Man.| Description                        |
    | call_id    | Yes | Call ID                            |
    | computer   | Yes | CP name                            |
    | hand_id    | Yes | rm2prb hand's Hand ID of the call  |
    | focus_id   | Yes | rm2prb hand's Focus ID of the call |
    
    | Return value | None |

    Example
    | release_specfied_call | call_id | computer | hand_id | focus_id |
    """
    release_flag = True
    command = """lgutilgx RID:%s:%s,%s""" % (computer, hand_id, focus_id)
    print "collect call info with command:", command
    call_info_str = connections.execute_mml_without_check(command)
    leg_pattern = re.compile("RES_TYPE\s+PRID\s+ENC\s+CAC_ALLOC\s+(\S+)")
    leg_list = leg_pattern.findall(call_info_str)
        
    for leg in leg_list:
        if leg != "OUT":
            command = "lgutilgx RV:%s:%s:%s" %(computer, call_id, leg)
            result = connections.execute_mml_without_check(command)
            if -1 == result.find("SUCCESSFUL"):
                release_flag = False
    if "OUT" in leg_list:
        command = "lgutilgx RV:%s:%s:OUT" %(computer, call_id)
        result = connections.execute_mml_without_check(command)
        if -1 == result.find("SUCCESSFUL"):
            release_flag = False
    if release_flag == False:
        raise exceptions.raise_ILError("ILCommandExecuteError", "release leg failed")
Esempio n. 23
0
 def check_value(self, phy_addr, log_addr, m_t_agent_type, m_t_montype,
                 m_t_spare):
     if (self.monheader_t_ident <> "c6c6"):
         exceptions.raise_ILError("ILCommandExecuteError",
                                  "The monheader_t_ident is not c6c6.")
     if (self.monheader_t_unitmbaddr <> phy_addr[2:6]):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The monheader_t_unitmbaddr is not %s." % phy_addr[2:6])
     if (self.monheader_t_unitlgaddr <> log_addr[2:6]):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The monheader_t_unitlgaddr is not %s." % log_addr[2:6])
     if (self.monheader_t_agenttype_t <> m_t_agent_type):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The monheader_t_agenttype_t is not %s." % m_t_agent_type)
     if (self.monheader_t_montype <> m_t_montype):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The monheader_t_montype is not %s." % m_t_montype)
     if (self.monheader_t_spare <> m_t_spare):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The monheader_t_spare is not %s." % m_t_spare)
Esempio n. 24
0
 def check_c6c6_headers_count(self, c6c6_count):
     if self.c6c6_headers_count <> int(c6c6_count):
         exceptions.raise_ILError(
             "ILCommandExecuteError",
             "The c6c6 headers count is not %s." % c6c6_count)
Esempio n. 25
0
def monster_output_file_format_is_correct_according_givaxi_monitoring_interface(
        dir_name, file_name, omu_phy_address, omu_log_address):
    """This keyword is to check that the file is saved correctly according to givaxi monitoring interface
           
    | Parameters   | Man. | Description              |
    | output_dir   | Yes  | the directory name       |
    | output_file  | Yes  | the file name            |
    | omu_phy_address | Yes  | the omu physical address |
    | omu_log_address | Yes  | the omu logical address  |
    
    | Return value | all headers length(c5c5, c6c6) |

    Example
    | monster output file format is correct according to givaxi monitoring interface |   monster_test | test.mgi | 0x0100 | 0x4002 |
    """
    headers_length = []
    _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))
    headers_length.append(header_length)
    ##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
        exceptions.raise_ILError(
            "ILCommandExecuteError",
            "There are no c6c6 headers found in the file.")

    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, omu_phy_address, omu_log_address)
        header_length = str(
            int(
                output_givaxi_message.c6c6_headers[c6c6_index].
                monheader_t_length, 16))
        headers_length.append(header_length)
        ##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 headers_length