Пример #1
0
def fio_ephemeral(test):
    tenants = test.tenants

    kill_commands = []
    run_kill = ['killall', 'fio']
    for group in test.group_servers_by_role().values():
        for server in group:
            kill_commands.append((server.management_ip, run_kill))
    remote.run_commands(kill_commands,
                        timeout=test.args.get('server_timeout', 30))

    # Run clients...

    client_commands = []
    additional_args = test.args.get('fio_args', [])

    run_fio = [
        'fio', '--directory=', '/tmp', '--name=', test.name,
        '--output-format=', 'json', '--group_reporting'
    ].extend(additional_args)
    print 'Running fio...'
    for group in test.group_servers_by_role().values():
        for server in group:
            client_commands.append((server.management_ip, run_fio))

    client_results = remote.run_commands(client_commands, fio.FioStats(test),
                                         test.args.get('client_timeout', 600))

    client_results.output()
Пример #2
0
def iperf_gateway(test, output_file):
    # Generate list of servers
    def server_list():
        ips = ['10.119.150.' + str(i) for i in range(194, 213)]
        for port in range(5200, 5300, 2):
            for ip in ips:
                yield {'ip': ip, 'port': port}

    servers = server_list()

    # Prepare servers...
    client_commands = []
    additional_args = test.args.get('iperf_args', [])
    for tenant in test.tenants:
        grouped_servers = tenant.group_servers_by_role()
        for client, server in zip(grouped_servers['client'], servers):
            run_client1 = [
                '/usr/local/bin/iperf3', '-c', server['ip'], '-p',
                server['port'], '--json'
            ]
            run_client1.extend(additional_args)
            client_commands.append((client.management_ip, run_client1))

    print len(client_commands), 'pairs generated.'

    print 'Running iperf...'
    client_results = remote.run_commands(client_commands,
                                         iperf3.Iperf3Stats(test),
                                         test.args.get('client_timeout', 600))

    client_results.output(output_file)
Пример #3
0
def iperf_gateway(test, output_file):
    # Generate list of servers
    def server_list():
        ips = ['10.119.150.' + str(i) for i in range(194, 213)]
        for port in range(5200, 5300, 2):
            for ip in ips:
                yield {'ip': ip, 'port': port}
    servers = server_list()

    # Prepare servers...
    client_commands = []
    additional_args = test.args.get('iperf_args', [])
    for tenant in test.tenants:
        grouped_servers = tenant.group_servers_by_role()
        for client, server in zip(grouped_servers['client'], servers):
            run_client1 = ['/usr/local/bin/iperf3', '-c', server['ip'],
                           '-p', server['port'], '--json']
            run_client1.extend(additional_args)
            client_commands.append((client.management_ip, run_client1))

    print len(client_commands), 'pairs generated.'

    print 'Running iperf...'
    client_results = remote.run_commands(
        client_commands, iperf3.Iperf3Stats(test),
        test.args.get('client_timeout', 600))

    client_results.output(output_file)
Пример #4
0
def iperf_pairs_duplex(test, output_file):
    tenants = test.tenants

    kill_commands = []
    run_kill = ['killall', 'iperf3']
    for group in test.group_servers_by_role().values():
        for server in group:
            kill_commands.append((server.management_ip, run_kill))
    remote.run_commands(kill_commands,
                        timeout=test.args.get('server_timeout', 30))

    # Prepare servers...
    server_commands = []
    run_server = ['/usr/local/bin/iperf3', '-s', '-D', '-p', '8200']
    for group in test.group_servers_by_role().values():
        for server in group:
            server_commands.append((server.management_ip, run_server))
    remote.run_commands(server_commands,
                        timeout=test.args.get('server_timeout', 30))

    # Run clients...
    client_commands = []
    additional_args = test.args.get('iperf_args', [])
    for tenant in tenants:
        grouped_servers = tenant.group_servers_by_role()
        for server, client in random_pairs(grouped_servers['server'],
                                           grouped_servers['client']):
            run_client = [
                '/usr/local/bin/iperf3', '-c', server.private_ip, '-p', '8200',
                '--json'
            ]
            run_client.extend(additional_args)
            run_server = [
                '/usr/local/bin/iperf3', '-c', client.private_ip, '-p', '8200',
                '--json'
            ]
            run_server.extend(additional_args)

            client_commands.append((client.management_ip, run_client))
            client_commands.append((server.management_ip, run_server))

    print 'Running iperf...'
    client_results = remote.run_commands(client_commands,
                                         iperf3.Iperf3Stats(test),
                                         test.args.get('client_timeout', 600))

    client_results.output(output_file)
Пример #5
0
def fio_volumes(test):
    tenants = test.tenants

    kill_commands = []
    run_kill = ['killall', 'fio']
    for group in test.group_servers_by_role().values():
        for server in group:
            kill_commands.append((server.management_ip, run_kill))
    remote.run_commands(kill_commands,
                        timeout=test.args.get('server_timeout', 30))

    # Run clients...

    prepare_commands = []
    client_commands = []
    device_name = test.args.get('device_name', '/dev/vdb')
    prepare_fs = ['/sbin/mkfs.ext4', device_name]
    mount_point = test.args.get('mount_point', '/mnt/fiodisk')
    mount_vol = ['mount', device_name, mount_point]

    for group in test.group_servers_by_role().values():
        for server in group:
            prepare_commands.append((server.management_ip, prepare_fs))
            prepare_commands.append((server.management_ip, mount_vol))

    print 'formatting and mounting volumes...'
    client_results = remote.run_commands(prepare_commands,
                                         test.args.get('server_timeout', 30))

    additional_args = test.args.get('fio_args', [])

    run_fio = [
        'fio', '--directory=', mount_point, '--name=', test.name,
        '--output-format=', 'json', '--group_reporting'
    ].extend(additional_args)
    print 'Running fio...'
    for group in test.group_servers_by_role().values():
        for server in group:
            client_commands.append((server.management_ip, run_fio))

    client_results = remote.run_commands(client_commands, fio.FioStats(test),
                                         test.args.get('client_timeout', 600))

    client_results.output()
Пример #6
0
def iperf_pairs_zmq(test, output_file):
    tenants = test.tenants

    kill_commands = []
    run_kill = ['killall', 'iperf3']
    for group in test.group_servers_by_role().values():
        for server in group:
            kill_commands.append((server.management_ip, run_kill))
    remote.run_commands(
        kill_commands, timeout=test.args.get('server_timeout', 30))

    # Prepare servers...
    clients = {}
    server_commands = []
    run_server = ['/usr/local/bin/iperf3', '-s', '-D', '-p', '8200']
    for tenant in tenants:
        grouped_servers = tenant.group_servers_by_role()
        for server, client in random_pairs(grouped_servers['server'],
                                           grouped_servers['client']):
            clients[server.management_ip] = (client, server)
            server_commands.append(
                (server.management_ip,
                 ['ping', '-c', '1', '-W', '1', client.private_ip]))
            server_commands.append((server.management_ip, run_server))
    server_results = remote.run_commands(
        server_commands, [], test.args.get('server_timeout', 30))

    # Run clients...
    client_commands = []
    additional_args = test.args.get('iperf_args', [])
    for server_address in set(r['address'] for r in server_results):
        client, server = clients[server_address]
        run_client = ['/usr/local/bin/iperf3', '-c', server.private_ip, '-p',
                      '8200', '--json']
        run_client.extend(additional_args)
        client_commands.append((client.management_ip, run_client))

    print 'Running iperf...'
    client_results = remote.run_commands(
        client_commands, iperf3.Iperf3Stats(test),
        test.args.get('client_timeout', 600))

    client_results.output(output_file)
Пример #7
0
def ab_lbaas(test):
    tenants = test.tenants

    neutron = api_helpers.get_neutron_client()

    # Run clients...
    commands = []
    args = test.args.get('ab_args', [])
    url = test.args.get('url', '')
    for tenant in tenants:
        pool = neutron.create_pool(
            dict(
                pool={
                    "tenant_id": tenant.tenant_id,
                    "name": "web_pool",
                    "protocol": "HTTP",
                    "lb_method": "ROUND_ROBIN",
                    "subnet_id": tenant.networks[0].subnet_id,
                }))['pool']
        vip = neutron.create_vip(
            dict(
                vip={
                    "tenant_id": tenant.tenant_id,
                    "name": "web_vip",
                    "subnet_id": tenant.networks[0].subnet_id,
                    "protocol": "HTTP",
                    "protocol_port": 80,
                    "pool_id": pool['id'],
                    #"session_persistence" : {
                    #"type":"APP_COOKIE", "cookie_name":"jsessionid"}
                }))['vip']

        url = test.args.get('url', '') % dict(vip=vip['address'])
        grouped_servers = tenant.group_servers_by_role()
        for server in grouped_servers['server']:
            neutron.create_member(
                dict(
                    member={
                        "address": server.private_ip,
                        "protocol_port": 80,
                        "pool_id": pool['id']
                    }))

        for client in grouped_servers['client']:
            commands.append((client.management_ip, ['ab'] + args + [url]))

    print 'Running iperf...'
    results = remote.run_commands(commands, [], test.args.get('timeout', 600))

    for result in results:
        print result['results'][0]['error']
        print result['results'][0]['output']
Пример #8
0
def ab_lbaas(test):
    tenants = test.tenants

    neutron = api_helpers.get_neutron_client()

    # Run clients...
    commands = []
    args = test.args.get('ab_args', [])
    url = test.args.get('url', '')
    for tenant in tenants:
        pool = neutron.create_pool(dict(pool={
            "tenant_id": tenant.tenant_id,
            "name": "web_pool",
            "protocol": "HTTP",
            "lb_method": "ROUND_ROBIN",
            "subnet_id": tenant.networks[0].subnet_id,
        }))['pool']
        vip = neutron.create_vip(dict(vip={
            "tenant_id": tenant.tenant_id,
            "name": "web_vip",
            "subnet_id": tenant.networks[0].subnet_id,
            "protocol": "HTTP",
            "protocol_port": 80,
            "pool_id": pool['id'],
            #"session_persistence" : {
            #"type":"APP_COOKIE", "cookie_name":"jsessionid"}
        }))['vip']

        url = test.args.get('url', '') % dict(vip=vip['address'])
        grouped_servers = tenant.group_servers_by_role()
        for server in grouped_servers['server']:
            neutron.create_member(dict(member={
                "address": server.private_ip,
                "protocol_port": 80,
                "pool_id": pool['id']
            }))

        for client in grouped_servers['client']:
            commands.append((client.management_ip, ['ab'] + args + [url]))

    print 'Running iperf...'
    results = remote.run_commands(
        commands, [], test.args.get('timeout', 600))

    for result in results:
        print result['results'][0]['error']
        print result['results'][0]['output']
Пример #9
0
def ping_pairs(test, output_file):
    ping_count = test.args.get('ping_count', 10)
    tenants = test.tenants

    # Prepare servers...
    commands = []
    for tenant in tenants:
        grouped_servers = tenant.group_servers_by_role()
        for server, client in random_pairs(grouped_servers['server'],
                                           grouped_servers['client']):
            commands.append(
                (client.management_ip,
                 ['ping', '-c', ping_count, '-W', '1', server.private_ip]))
            commands.append(
                (server.management_ip,
                 ['ping', '-c', ping_count, '-W', '1', client.private_ip]))

    print 'Running pings...'
    results = remote.run_commands(commands, ping.PingStats(test),
                                  test.args.get('timeout', ping_count * 2))

    results.output(output_file)
Пример #10
0
def ping_pairs(test, output_file):
    ping_count = test.args.get('ping_count', 10)
    tenants = test.tenants

    # Prepare servers...
    commands = []
    for tenant in tenants:
        grouped_servers = tenant.group_servers_by_role()
        for server, client in random_pairs(grouped_servers['server'],
                                           grouped_servers['client']):
            commands.append(
                (client.management_ip,
                 ['ping', '-c', ping_count, '-W', '1', server.private_ip]))
            commands.append(
                (server.management_ip,
                 ['ping', '-c', ping_count, '-W', '1', client.private_ip]))

    print 'Running pings...'
    results = remote.run_commands(
        commands, ping.PingStats(test),
        test.args.get('timeout', ping_count * 2))

    results.output(output_file)