Exemplo n.º 1
0
def vm_is_login_in_slaveOS(parser):
    """
	vm is login in hostOS or not
	:param parser: config
	:return: True/raise exception
	"""

    if FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                     parser["TA_msg_sock_port"],
                     int(parser["ast_vm_login_wait_time"]
                         )):  #若回傳VM登入完成,則test oracle通過,否則raise exception
        return True
    else:
        ssh = shell_server.get_ssh(parser["GuestOS_ip_S"],
                                   parser["GuestOS_usr"],
                                   parser["GuestOS_pwd"])  #獲得ssh

        cmd = "sudo %s" % parser["login_reply_path"]
        #print cmd
        s_stdin, s_stdout, s_stderr = ssh.exec_command(cmd)  #透過ssh執行指令
        if FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                         parser["TA_msg_sock_port"],
                         int(parser["ast_vm_login_wait_time"]
                             )):  #若回傳VM登入完成,則test oracle通過,否則raise exception
            return True
        ssh.close()
    raise TA_error.Assert_Error("VM (name : %s) is not login in backupOS" %
                                parser["vm_name"])
Exemplo n.º 2
0
def preprocess_hostOS_vm_login(parser):
    """
    preprocess check hostOS vm is login

    :called func: preprocess_hostOS_OS_vm
    :param parser: is a dict, get from Test config file
    """
    if not FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                         parser["TA_msg_sock_port"],
                         int(parser["pre_hostOS_VM_login_time"])):
        raise TA_error.Preprocess_Error("PrimaryOS %s is not login" %
                                        parser["vm_name"])
Exemplo n.º 3
0
def postprocess_hostOS_ATCA_OS_running(parser):

    if parser["pos_boot_ATCA_hostOS"] == "yes":
        cmd = "ssh 172.16.33.222 'clia activate %s 0'" % (
            parser["PrimaryOS_ipmc_name"])

        ssh = shell_server.get_ssh(parser["BackupOS_ip"],
                                   parser["BackupOS_usr"],
                                   parser["BackupOS_pwd"])  #獲得ssh

        s_stdin, s_stdout, s_stderr = ssh.exec_command("sudo " + cmd)
        ssh.close()

        if not FTVM.is_login(parser["PrimaryOS_name"], parser["TA_ip"],
                             parser["TA_msg_sock_port"],
                             int(parser["pos_hostOS_login_time"])):
            raise TA_error.Postprocess_Error("PrimaryOS %s is not login" %
                                             parser["PrimaryOS_name"])