Beispiel #1
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)
Beispiel #2
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
Beispiel #3
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)
Beispiel #4
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)