示例#1
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()

    if not len(pairs):
        return api.types.status.FAILURE

    server = pairs[0][0]
    client = pairs[0][1]

    if tc.node_to_move == "client":
        tc.vm_node = client
    else:
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []
    serverReq = None
    clientReq = None

    serverReq = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    clientReq = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting FTP test from %s" % (tc.cmd_descr))

    SetupFTPServer(server.node_name, server.workload_name)
    SetupFTPClient(client.node_name, client.workload_name, server,
                   tc.iterators.mode)

    api.Trigger_AddCommand(serverReq, server.node_name, server.workload_name,
                           "fallocate -l 1G /home/admin/ftp/ftp_server.txt")
    tc.cmd_cookies.append("Before file transfer")
    api.Trigger_AddCommand(clientReq,
                           client.node_name,
                           client.workload_name,
                           "cd ftpdir && chmod +x ftp.sh && ./ftp.sh",
                           timeout=400)
    tc.cmd_cookies.append("Run FTP")

    api.Trigger_AddNaplesCommand(serverReq,
                                 tc.vm_node.node_name,
                                 "sleep 1",
                                 timeout=1)
    tc.cmd_cookies.append("Before Sleep")

    api.Trigger_AddNaplesCommand(serverReq, tc.vm_node.node_name,
                                 "/nic/bin/halctl show session --alg ftp")
    tc.cmd_cookies.append("Before vMotion - show session")

    # Trigger the commands
    tc.server_resp = api.Trigger(serverReq)
    tc.client_resp = api.Trigger(clientReq)

    # Trigger vMotion
    new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
    vm_utils.update_move_info(tc, [tc.vm_node], False, new_node)
    vm_utils.do_vmotion(tc, True)

    vm_utils.update_node_info(tc, tc.server_resp)
    vm_utils.update_node_info(tc, tc.client_resp)

    # After vMotion - Wait for Commands to end
    tc.client_resp = api.Trigger_WaitForAllCommands(tc.client_resp)

    # After vMotion - Show sessions dump after vMotion
    tc.cmd_cookies = []
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    ## Add Naples command validation
    api.Trigger_AddNaplesCommand(req, tc.vm_node.node_name,
                                 "/nic/bin/halctl show session --alg ftp")
    tc.cmd_cookies.append("show session FTP established")

    # Ensure full file is transferred by checking size
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "ls -lrth ftpdir/")
    tc.cmd_cookies.append("After get1")
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "sh -c 'du -kh ftpdir/ftp_server.txt | grep 1.0G'")
    tc.cmd_cookies.append("After get2")

    tc.resp = api.Trigger(req)

    Cleanup(server, client)

    return api.types.status.SUCCESS
示例#2
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()

    if not len(pairs):
        return api.types.status.FAILURE

    server = pairs[0][0]
    client = pairs[0][1]

    if tc.node_to_move == "client":
        tc.vm_node = client
    else:
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []

    serverReq = None
    clientReq = None

    serverReq = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    clientReq = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting DNS test from %s" % (tc.cmd_descr))

    SetupDNSServer(server)

    api.Trigger_AddCommand(serverReq, server.node_name, server.workload_name,
                           "sudo systemctl start named")
    tc.cmd_cookies.append("Before vMotion - Start Named")
    api.Trigger_AddCommand(serverReq, server.node_name, server.workload_name,
                           "sudo systemctl enable named")
    tc.cmd_cookies.append("Before vMotion - Enable Named")
    api.Trigger_AddCommand(clientReq, client.node_name, client.workload_name,
                           "sudo rm /etc/resolv.conf")
    tc.cmd_cookies.append("Before vMotion - Remove resolv.conf")

    api.Trigger_AddCommand(
        clientReq, client.node_name, client.workload_name,
        "sudo echo \'nameserver %s\' | sudo tee -a /etc/resolv.conf" %
        (server.ip_address))
    tc.cmd_cookies.append("Before vMotion - Setup resolv conf")

    api.Trigger_AddCommand(clientReq, client.node_name, client.workload_name,
                           "nslookup test3.example.com")
    tc.cmd_cookies.append("Before vMotion - Query DNS server")
    api.Trigger_AddNaplesCommand(
        clientReq, tc.vm_node.node_name,
        "/nic/bin/halctl show session --dstport 53 --dstip {}".format(
            server.ip_address))
    tc.cmd_cookies.append("Before vMotion - show session")

    # Trigger the commands
    tc.server_resp = api.Trigger(serverReq)
    tc.client_resp = api.Trigger(clientReq)
    tc.resp = api.Trigger_AggregateCommandsResponse(tc.server_resp,
                                                    tc.client_resp)

    # Trigger vMotion
    new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
    vm_utils.update_move_info(tc, [tc.vm_node], False, new_node)
    vm_utils.do_vmotion(tc, True)

    vm_utils.update_node_info(tc, tc.client_resp)

    # After vMotion - Wait for Commands to end
    tc.client_resp = api.Trigger_WaitForAllCommands(tc.client_resp)
    api.Trigger_TerminateAllCommands(tc.server_resp)

    # After vMotion - Show sessions dump after vMotion
    tc.cmd_cookies = []
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "nslookup test3.example.com")
    tc.cmd_cookies.append("After vMotion - Query DNS server")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)
    tc.resp = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    DNSCleanup(server, client)

    return api.types.status.SUCCESS
示例#3
0
def Trigger(tc):
    tc.cmd_cookies = []
    client, server, naples = tc.client, tc.server, tc.naples

    req = api.Trigger_CreateExecuteCommandsRequest(serial = True)
    cmd_cookie = "%s(%s) --> %s(%s)" %\
                (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting TCP aging test from %s" % (cmd_cookie))

    cmd_cookie = "halctl clear session"
    api.Trigger_AddNaplesCommand(req, server.node_name, "/nic/bin/halctl clear session")
    tc.cmd_cookies.append(cmd_cookie)

    #Step 0: Update the timeout in the config object
    if not tc.skip_security_prof:
        update_timeout('tcp-timeout', tc.iterators.timeout)
        timeout = timetoseconds(tc.iterators.timeout)
    else:
        timeout = DEFAULT_TCP_TIMEOUT

    #profilereq = api.Trigger_CreateExecuteCommandsRequest(serial = True)
    #api.Trigger_AddNaplesCommand(profilereq, naples.node_name, "/nic/bin/halctl show nwsec profile --id 11")
    #profcommandresp = api.Trigger(profilereq)
    #cmd = profcommandresp.commands[-1]
    #for command in profcommandresp.commands:
    #    api.PrintCommandResults(command)
    #timeout = get_haltimeout('tcp-timeout', cmd) 
    #tc.config_update_fail = 0
    #if (timeout != timetoseconds(tc.iterators.timeout)):
    #    tc.config_update_fail = 1

    server_port = api.AllocateTcpPort() 
    client_port = api.AllocateTcpPort()

    cmd_cookie = "Send SYN from client"
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "hping3 -c 1 -s %s -p %s -M 0 -L 0 -S %s" % (client_port, server_port, server.ip_address))
    tc.cmd_cookies.append(cmd_cookie)

    cmd_cookie = "Send SYN, ACK and SEQ from server"
    api.Trigger_AddCommand(req, server.node_name, server.workload_name,
                           "hping3 -c 1 -s %s -p %s -M 0 -A -L 1 -S %s" % (server_port, client_port, client.ip_address))
    tc.cmd_cookies.append(cmd_cookie)

    #Get Seq + Ack
    api.Trigger_AddNaplesCommand(req, naples.node_name,
                "/nic/bin/halctl show session ".format(server_port, server.ip_address))
    tc.cmd_cookies.append("show session")
    api.Trigger_AddNaplesCommand(req, naples.node_name,
                "/nic/bin/halctl show session --dstport {} --dstip {} --yaml".format(server_port, server.ip_address))
    tc.cmd_cookies.append("show session detail")
    trig_resp1 = api.Trigger(req)
    cmd = trig_resp1.commands[-1]
    for command in trig_resp1.commands:
        api.PrintCommandResults(command)
    iseq_num, iack_num, iwindosz, iwinscale, rseq_num, rack_num, rwindo_sz, rwinscale = get_conntrackinfo(cmd)

    #Send ACK
    req2 = api.Trigger_CreateExecuteCommandsRequest(serial = True)
    api.Trigger_AddCommand(req2, client.node_name, client.workload_name,
               "hping3 -c 1 -s {} -p {} -M {}  -L {} --ack {}".format(client_port, server_port, rack_num, rseq_num, server.ip_address))
    tc.cmd_cookies.append("Send ACK") 

    cmd_cookie = "Before moving show session"
    api.Trigger_AddNaplesCommand(req2, naples.node_name, "/nic/bin/halctl show session --dstport {} --dstip {} | grep ESTABLISHED".format(server_port, server.ip_address))
    tc.cmd_cookies.append(cmd_cookie)

     # vm_utils.do_vmotion(tc, tc.wl, tc.new_node)
     vm_utils.do_vmotion(tc, True)
示例#4
0
def Trigger(tc):
    if tc.args.type == 'local_only':
        local_pairs = api.GetLocalWorkloadPairs()
    else:
        remote_pairs = api.GetRemoteWorkloadPairs()
    tc.skip_security_prof = getattr(tc.args, "skip_security_prof", False)
    tc.cmd_cookies       = []
    tc.cmd_cookies_after = []
    server,client  = local_pairs[0]
    wl1 = server
    wl2 = client
    tc.wl       = wl1
    tc.old_node = server.node_name

    if not server.IsNaples():
        return api.types.status.SUCCESS

    # remove the node being used to pick wl for traffic
    # pick the next node in the naples nodes
    naples_nodes = tc.Nodes[:]
    naples_nodes.remove(server.node_name)
    assert(len(naples_nodes) >= 1)
    new_node     = naples_nodes[0]
    tc.new_node  = new_node
    move_info    = vm_utils.MoveInfo()
    move_info.new_node = new_node
    move_info.wl       = wl1
    move_info.old_node = wl1.node_name
    tc.move_info.append(move_info)


    req = api.Trigger_CreateExecuteCommandsRequest(serial = True)
    cmd_cookie = "%s(%s) --> %s(%s)" %\
                (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting Iperf test from %s" % (cmd_cookie))

    cmd_cookie = "halctl clear session"
    api.Trigger_AddNaplesCommand(req, server.node_name, "/nic/bin/halctl clear session")
    tc.cmd_cookies.append(cmd_cookie)

    server_port = api.AllocateUdpPort()
    basecmd = 'iperf -u '
    timeout_str = 'udp-timeout'
    if not tc.skip_security_prof:
        timeout = get_timeout(timeout_str)
    else:
        timeout = VMOTION_UDP_TIMEOUT

    #Step 0: Update the timeout in the config object
    if not tc.skip_security_prof:
        update_timeout(timeout_str, tc.iterators.timeout)

    #profilereq = api.Trigger_CreateExecuteCommandsRequest(serial = True)
    #api.Trigger_AddNaplesCommand(profilereq, wl1.node_name, "/nic/bin/halctl show nwsec profile --id 11")
    #profcommandresp = api.Trigger(profilereq)
    #cmd = profcommandresp.commands[-1]
    #for command in profcommandresp.commands:
    #    api.PrintCommandResults(command)
    #timeout = get_haltimeout(timeout_str, cmd)
    #tc.config_update_fail = 0
    #if (timeout != timetoseconds(tc.iterators.timeout)):
    #    tc.config_update_fail = 1

    cmd_cookie = "start server"
    api.Trigger_AddCommand(req, server.node_name, server.workload_name,
                           "%s -p %s -s -t 180" % (basecmd, server_port), background = True)
    tc.cmd_cookies.append(cmd_cookie)

    cmd_cookie = "start client"
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "%s -p %s -c %s -t 180" % (basecmd, server_port, server.ip_address), background = True)
    tc.cmd_cookies.append(cmd_cookie)

    cmd_cookie = "Before move show session"
    api.Trigger_AddNaplesCommand(req, wl1.node_name, "/nic/bin/halctl show session --dstip %s | grep UDP" % (server.ip_address))
    tc.cmd_cookies.append(cmd_cookie)

    trig_resp = api.Trigger(req)

     # vm_utils.do_vmotion(tc, server, new_node)
     vm_utils.do_vmotion(tc, True)
示例#5
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()

    if not len(pairs):
        return api.types.status.FAILURE

    server = pairs[0][0]
    client = pairs[0][1]

    if tc.node_to_move == "client":
        tc.vm_node = client
    else:
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []

    serverReq = None
    clientReq = None

    trigger_req = api.Trigger_CreateExecuteCommandsRequest(serial = True)

    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting TFTP test from %s" % (tc.cmd_descr))

    SetupTFTPServer(server)
    SetupTFTPClient(client)

    api.Trigger_AddCommand(trigger_req, server.node_name, server.workload_name, "fallocate -l 1G tftpdir/tftp_server.txt")
    tc.cmd_cookies.append("Before file transfer1")
    api.Trigger_AddCommand(trigger_req, server.node_name, server.workload_name, "cp tftpdir/tftp_server.txt /var/lib/tftpboot")
    tc.cmd_cookies.append("Before file transfer2")
    api.Trigger_AddCommand(trigger_req, server.node_name, server.workload_name, "chmod 666 /var/lib/tftpboot/tftp_server.txt")
    tc.cmd_cookies.append("Before file transfer3")

    api.Trigger_AddCommand(trigger_req, client.node_name, client.workload_name,
                           "sh -c 'cd tftpdir && tftp -v %s -c get tftp_server.txt'" % server.ip_address,
                           background = True)
    tc.cmd_cookies.append("After initiating TFTP Get")

    # Trigger the commands
    tc.trigger_resp = api.Trigger(trigger_req)

    # Trigger vMotion
    new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
    vm_utils.update_move_info(tc,[tc.vm_node],False,new_node)
    vmotion_resp = vm_utils.do_vmotion(tc, True)

    vm_utils.update_node_info(tc, tc.trigger_resp)

    # After vMotion - Wait for Commands to end
    tc.trigger_resp = api.Trigger_WaitForAllCommands(tc.trigger_resp)

    if vmotion_resp != api.types.status.SUCCESS:
        api.Logger.info("vmotion trigger failed, skipping further trigger")
        return vmotion_resp

    # After vMotion - Show sessions dump after vMotion
    tc.cmd_cookies = []
    req = api.Trigger_CreateExecuteCommandsRequest(serial = True)

    api.Trigger_AddNaplesCommand(req, tc.vm_node.node_name, "/nic/bin/halctl show session | grep UDP")
    tc.cmd_cookies.append("show session TFTP")

    api.Trigger_AddNaplesCommand(req, tc.vm_node.node_name, "/nic/bin/halctl show nwsec flow-gate | grep TFTP")
    tc.cmd_cookies.append("show flow-gate")
 
    # Ensure full file is transferred by checking size 
    api.Trigger_AddCommand(req, client.node_name, client.workload_name, "ls -lrth tftpdir/")
    tc.cmd_cookies.append("After get1")
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "sh -c 'du -kh tftpdir/tftp_server.txt | grep 1.0G'")
    tc.cmd_cookies.append("After get2")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)
    tc.resp   = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    Cleanup(server, client)

    return api.types.status.SUCCESS
示例#6
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()

    if not len(pairs):
        return api.types.status.FAILURE

    server = pairs[0][0]
    client = pairs[0][1]

    if tc.node_to_move == "client":
        tc.vm_node = client
    else:
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []

    serverReq = None
    clientReq = None

    serverReq = api.Trigger_CreateExecuteCommandsRequest(serial=False)
    clientReq = api.Trigger_CreateExecuteCommandsRequest(serial=False)

    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting RTSP test from %s" % (tc.cmd_descr))

    dir_path = os.path.dirname(os.path.realpath(__file__))
    fullpath = dir_path + '/' + "sample.vob"
    resp = api.CopyToWorkload(server.node_name, server.workload_name,
                              [fullpath], 'rtspdir')
    if resp is None:
        return api.types.status.FAILURE

    api.Trigger_AddCommand(serverReq,
                           server.node_name,
                           server.workload_name,
                           "cd rtspdir && live555MediaServer",
                           background=True)
    tc.cmd_cookies.append("Run RTSP server")

    api.Trigger_AddCommand(clientReq, client.node_name, client.workload_name,
                           "openRTSP rtsp://%s/sample.vob" % server.ip_address)
    tc.cmd_cookies.append("Run RTSP client")

    # Trigger the commands
    tc.server_resp = api.Trigger(serverReq)
    tc.client_resp = api.Trigger(clientReq)
    tc.resp = api.Trigger_AggregateCommandsResponse(tc.server_resp,
                                                    tc.client_resp)

    # Trigger vMotion
    new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
    vm_utils.update_move_info(tc, [tc.vm_node], False, new_node)
    vm_utils.do_vmotion(tc, True)

    vm_utils.update_node_info(tc, tc.client_resp)

    # After vMotion - Wait for Commands to end
    tc.client_resp = api.Trigger_WaitForAllCommands(tc.client_resp)
    api.Trigger_TerminateAllCommands(tc.server_resp)

    # After vMotion - Show sessions dump after vMotion
    tc.cmd_cookies = []
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    api.Trigger_AddNaplesCommand(
        req, tc.vm_node.node_name,
        "/nic/bin/halctl show session --alg rtsp --yaml")
    tc.cmd_cookies.append("show session RTSP")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)
    tc.resp = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    return api.types.status.SUCCESS
示例#7
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()
    if not len(pairs):
        return api.types.status.FAILURE
    server = pairs[0][0]
    client = pairs[0][1]
    tc.server = server
    tc.client = client
    if tc.node_to_move == "client":
        api.Logger.info("Moving client %s" % (client.workload_name))
        tc.vm_node = client
    else:
        api.Logger.info("Moving server %s" % (client.workload_name))
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []

    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting SUNRPC test from %s" % (tc.cmd_descr))

    # this setups control session for alg-sunrpc
    SetupNFSServer(server, client)

    api.Trigger_AddCommand(
        req, server.node_name, server.workload_name,
        "sh -c 'ls -al /home/sunrpcmntdir | grep sunrpc_file.txt'")
    tc.cmd_cookies.append("Before rpc")

    # this setups data session for alg-sunrpc
    api.Trigger_AddCommand(
        req, client.node_name, client.workload_name,
        "sudo sh -c 'mkdir -p /home/sunrpcdir && mount %s:/home/sunrpcmntdir /home/sunrpcdir' "
        % (server.ip_address))
    tc.cmd_cookies.append("Create mount point")

    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "sudo chmod 777 /home/sunrpcdir")
    tc.cmd_cookies.append("add permission")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)

    tc.resp = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    #trigger a vmotion at this point
    new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
    vm_utils.update_move_info(tc, [tc.vm_node], False, new_node)
    tc.resp = vm_utils.do_vmotion(tc, True)
    if tc.resp != api.types.status.SUCCESS:
        api.Logger.info("vmotion at vcenter failed")
        return api.types.status.SUCCESS

    tc.cmd_cookies = []
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    # make sure a file change in client reflects on server
    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "mv sunrpcdir/sunrpc_file.txt /home/sunrpcdir/")
    tc.cmd_cookies.append("Create file")

    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "ls -al /home/sunrpcdir")
    tc.cmd_cookies.append("verify file")

    api.Trigger_AddCommand(req, server.node_name, server.workload_name,
                           "ls -al /home/sunrpcmntdir/")
    tc.cmd_cookies.append("After rpc1")

    api.Trigger_AddCommand(req, server.node_name, server.workload_name,
                           "sh -c 'cat /home/sunrpcmntdir/sunrpc_file.txt'")
    tc.cmd_cookies.append("After rpc2")

    # Add Naples command validation
    api.Trigger_AddNaplesCommand(req, tc.vm_node.node_name,
                                 "/nic/bin/halctl show session --alg sun_rpc")
    tc.cmd_cookies.append("show session")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)

    tc.resp = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    return api.types.status.SUCCESS
示例#8
0
def Trigger(tc):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    tc.cmd_cookies1 = []

    #Step 0: Update the timeouti & connection-tracking in the config object
    if not tc.skip_security_prof:
        update_timeout("icmp-timeout", tc.iterators.timeout)

    w1, w2 = tc.workload_pairs[0]
    cmd_cookie = "%s(%s) --> %s(%s)" %\
                  (w1.workload_name, w1.ip_address, w2.workload_name, w2.ip_address)
    api.Logger.info("Starting Ping test from %s" % (cmd_cookie))

    cmd_cookie = "halctl clear session"
    api.Trigger_AddNaplesCommand(req, tc.old_node,
                                 "/nic/bin/halctl clear session")
    tc.cmd_cookies1.append(cmd_cookie)

    if not tc.skip_security_prof:
        timeout = timetoseconds(tc.iterators.timeout) + GRACE_TIME
    else:
        timeout = str(DEFAULT_ICMP_TIMEOUT + GRACE_TIME)

    cmd_cookie = "ping"
    api.Trigger_AddCommand(req,
                           w1.node_name,
                           w1.workload_name,
                           "ping -c 180 %s" % w2.ip_address,
                           background=True)
    tc.cmd_cookies1.append(cmd_cookie)

    cmd_cookie = "Before move show session ICMP"
    api.Trigger_AddNaplesCommand(req, tc.old_node,
                                 "/nic/bin/halctl show session | grep ICMP")
    tc.cmd_cookies1.append(cmd_cookie)
    tc.resp1 = api.Trigger(req)

    # vm_utils.do_vmotion(tc, tc.wl, tc.new_node)
    vm_utils.do_vmotion(tc, True)

    #import pdb; pdb.set_trace()

    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    tc.cmd_cookies = []

    cmd_cookie = "After move show session ICMP"
    api.Trigger_AddNaplesCommand(req, tc.wl.node_name,
                                 "/nic/bin/halctl show session | grep ICMP")
    tc.cmd_cookies.append(cmd_cookie)

    #Get it from the config
    cmd_cookie = "sleep"
    api.Trigger_AddNaplesCommand(req,
                                 tc.wl.node_name,
                                 "sleep 180",
                                 timeout=210)
    tc.cmd_cookies.append(cmd_cookie)

    cmd_cookie = "After aging show session"
    api.Trigger_AddNaplesCommand(req, tc.wl.node_name,
                                 "/nic/bin/halctl show session | grep ICMP")
    tc.cmd_cookies.append(cmd_cookie)

    tc.resp = api.Trigger(req)
    return api.types.status.SUCCESS
示例#9
0
def Trigger(tc):
    tc.resp = vm_utils.do_vmotion(tc, tc.vm_dsc_to_dsc)
    return tc.resp 
示例#10
0
def Trigger(tc):
    if tc.local_or_remote == "local":
        pairs = api.GetLocalWorkloadPairs()
    else:
        pairs = api.GetRemoteWorkloadPairs()
    if not len(pairs):
        return api.types.status.FAILURE
    server = pairs[0][0]
    client = pairs[0][1]
    tc.server = server
    tc.client = client
    if tc.node_to_move == "client":
        api.Logger.info("Moving client %s" % (client.workload_name))
        tc.vm_node = client
    else:
        api.Logger.info("Moving server %s" % (client.workload_name))
        tc.vm_node = server

    vm_utils.get_vm_dbg_stats(tc)

    tc.cmd_cookies = []
    num_moves_done = 0
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    tc.cmd_descr = "Server: %s(%s) <--> Client: %s(%s)" %\
                   (server.workload_name, server.ip_address, client.workload_name, client.ip_address)
    api.Logger.info("Starting SUNRPC test from %s" % (tc.cmd_descr))

    # this setups control session for alg-sunrpc
    SetupNFSServer(server, client)

    api.Trigger_AddCommand(
        req, server.node_name, server.workload_name,
        "sh -c 'ls -al /home/sunrpcmntdir | grep sunrpc_file.txt'")
    tc.cmd_cookies.append("Before rpc")

    # this setups data session for alg-sunrpc
    api.Trigger_AddCommand(
        req, client.node_name, client.workload_name,
        "sudo sh -c 'mkdir -p /home/sunrpcdir && mount %s:/home/sunrpcmntdir /home/sunrpcdir' "
        % (server.ip_address))
    tc.cmd_cookies.append("Create mount point")

    api.Trigger_AddCommand(req, client.node_name, client.workload_name,
                           "sudo chmod 777 /home/sunrpcdir")
    tc.cmd_cookies.append("add permission")

    trig_resp = api.Trigger(req)
    term_resp = api.Trigger_TerminateAllCommands(trig_resp)

    tc.resp = api.Trigger_AggregateCommandsResponse(trig_resp, term_resp)

    while (num_moves_done < tc.num_b2b_moves):
        #trigger a vmotion at this point
        api.Logger.info("moving %s for %d time" %
                        (tc.vm_node.workload_name, num_moves_done))
        new_node = vm_utils.find_new_node_to_move_to(tc, tc.vm_node)
        vm_utils.update_move_info(tc, [tc.vm_node], False, new_node)
        vm_utils.do_vmotion(tc, True)

        trigger_data_update(tc)
        ret = verify_cmd_resp(tc)
        if ret != api.types.status.SUCCESS:
            return ret
        cleanup_trigger(tc)
        api.Logger.info("sleeping for 10 sec before next move %s" %
                        (tc.vm_node.workload_name))
        time.sleep(10)
        num_moves_done = num_moves_done + 1
    return api.types.status.SUCCESS