Beispiel #1
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name)

    # run test
    print 'Running test on instance...'

    # instance create time
    collect_information(instance_name, 'create')

    # instance reboot time
    reboot_the_instance(instance_name)
    collect_information(instance_name, 'reboot')

    # Additional instance reboot time
    #for i in range(1,3):
    #    reboot_the_instance(instance_name)
    #    collect_information(instance_name, 'reboot{0}'.format(i))

    # get log
    print 'Getting log files...'
    collect_log_from_instance(TSCFG, instance_name)

    return
Beispiel #2
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name)

    # run test
    print 'Running test on instance...'

    result = run_shell_command_on_instance(
        region=TSCFG['REGION'],
        instance_name=instance_name,
        cmd_line='/bin/bash ~/workspace/bin/test1.sh')
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    waiting_for_instance_online(region=TSCFG['REGION'],
                                instance_name=instance_name,
                                user_name=TSCFG['USER_NAME'])

    result = run_shell_command_on_instance(
        region=TSCFG['REGION'],
        instance_name=instance_name,
        cmd_line='/bin/bash ~/workspace/bin/test2.sh')
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    # get log
    print 'Getting log files...'
    collect_log_from_instance(TSCFG, instance_name)

    return
Beispiel #3
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name + '-s')
    prepare_on_instance(TSCFG, instance_name + '-c')

    # run test
    print 'Running test on instance...'

    ## step 1: basic information
    result = run_shell_command_on_instance(
        region=TSCFG['REGION'],
        instance_name=instance_name + '-c',
        cmd_line='/bin/bash ~/workspace/bin/test.sh')
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    inst_id = get_instance_info_by_name(region=TSCFG['REGION'],
                                        instance_name=instance_name +
                                        '-c')['id']
    log_save_path = TSCFG['LOG_SAVE_PATH'] + TSCFG['CASE_ID'] + '/'
    log_file = log_save_path + 'aws_check_' + instance_type + '.log'

    os.system('mkdir -p ' + log_save_path)
    os.system('aws ec2 describe-instances --instance-id {0} > {1}'.format(
        inst_id, log_file))
    os.system(
        'aws ec2 describe-instance-attribute --instance-id {0} --attribute sriovNetSupport >> {1}'
        .format(inst_id, log_file))

    ## step 2: iperf test
    result = run_shell_command_on_instance(
        region=TSCFG['REGION'],
        instance_name=instance_name + '-s',
        cmd_line='/bin/bash ~/workspace/bin/iperf_server.sh')
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    server_ip = get_instance_info_by_name(region=TSCFG['REGION'],
                                          instance_name=instance_name +
                                          '-s')['private_ip_address']

    result = run_shell_command_on_instance(
        region=TSCFG['REGION'],
        instance_name=instance_name + '-c',
        cmd_line='/bin/bash ~/workspace/bin/iperf_client.sh {0}'.format(
            server_ip))
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    # get log
    print 'Getting log files...'
    collect_log_from_instance(TSCFG, instance_name + '-s')
    collect_log_from_instance(TSCFG, instance_name + '-c')

    return
Beispiel #4
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name)

    # run test
    print 'Running test on instance...'
    pass

    # get log
    print 'Getting log files...'
    pass

    return
Beispiel #5
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name + '-s')
    prepare_on_instance(TSCFG, instance_name + '-c')

    # run test
    print 'Running test on instance...'

    ## get ip address
    server_ip = get_instance_info_by_name(region=TSCFG['REGION'], instance_name=instance_name+'-s')['private_ip_address']
    client_ip = get_instance_info_by_name(region=TSCFG['REGION'], instance_name=instance_name+'-c')['private_ip_address']

    response = get_ipv6_addresses(region=TSCFG['REGION'], instance_name=instance_name+'-s')
    server_ipv6 = response[0] if response else ''
    response = get_ipv6_addresses(region=TSCFG['REGION'], instance_name=instance_name+'-c')
    client_ipv6 = response[0] if response else ''

    ## run on server
    result = run_shell_command_on_instance(region=TSCFG['REGION'],
                                           instance_name=instance_name+'-s',
                                           user_name=TSCFG['USER_NAME'],
                                           cmd_line='/bin/bash ~/workspace/bin/test.sh server {0} {1}'.format(client_ip, client_ipv6))
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    ## run on client
    result = run_shell_command_on_instance(region=TSCFG['REGION'],
                                           instance_name=instance_name+'-c',
                                           user_name=TSCFG['USER_NAME'],
                                           cmd_line='/bin/bash ~/workspace/bin/test.sh client {0} {1}'.format(server_ip, server_ipv6))
    #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

    # get log
    print 'Getting log files...'
    collect_log_from_instance(TSCFG, instance_name + '-s')
    collect_log_from_instance(TSCFG, instance_name + '-c')

    return
Beispiel #6
0
def run_test(instance_name, instance_type=None):

    # prepare
    print 'Preparing environment...'
    prepare_on_instance(TSCFG, instance_name)

    # run test
    #    for volume in TSCFG['ATTACHED_VOLUME_IDS']:
    #        volume_id = volume.split(';')[0]
    #        volume_type = volume.split(';')[1]

    for volume_type in ('gp2', 'io1', 'st1', 'sc1'):

        iops = None

        if volume_type == 'gp2':
            # define gp2 volume
            volume_size = 3334

        if volume_type == 'io1':
            # define io1 volume
            volume_size = 400
            iops = 20000

        if volume_type == 'st1':
            # define st1 volume
            volume_size = 12.5 * 1024

        if volume_type == 'sc1':
            # define sc1 volume
            volume_size = 16 * 1024

        # create the volume
        availability_zone = get_availability_zone(region=TSCFG['REGION'],
                                                  instance_name=instance_name)
        volume = create_volume(region=TSCFG['REGION'],
                               availability_zone=availability_zone,
                               volume_type=volume_type,
                               volume_size=volume_size,
                               iops=iops)

        # attach the volume
        print 'Attaching test volume...'
        attach_volume_to_instance(region=TSCFG['REGION'],
                                  instance_name=instance_name,
                                  volume_id=volume.id,
                                  volume_delete_on_termination=True)

        # test the volume
        print 'Running test on instance...'
        result = run_shell_command_on_instance(
            region=TSCFG['REGION'],
            instance_name=instance_name,
            user_name=TSCFG['USER_NAME'],
            cmd_line='/bin/bash ~/workspace/bin/test.sh ' + volume_type)
        #print 'status:\n----------\n%s\nstdout:\n----------\n%s\nstderr:\n----------\n%s\n' % (result)

        # detach the volume
        print 'Detaching test volume...'
        detach_volume_from_instance(region=TSCFG['REGION'],
                                    instance_name=instance_name,
                                    volume_id=volume.id,
                                    force=True)

        # delete the volume
        delete_volume(volume_id=volume.id)

    # get log
    print 'Getting log files...'
    collect_log_from_instance(TSCFG, instance_name)

    return