Exemplo n.º 1
0
def rodar_macvlan(cliente, servidor1, servidor2, servidor3, logDir):
    #############################################################################
    # TrafegoDC
    timePrint("TrafegoDC [STARTING]")
    s1 = servidor1.docker.containers.run(image="mentz/tcc:latest",
                                         network=config.nwName_macvlan,
                                         command="/root/etg-server",
                                         detach=True)

    s2 = servidor2.docker.containers.run(image="mentz/tcc:latest",
                                         network=config.nwName_macvlan,
                                         command="/root/etg-server",
                                         detach=True)

    s3 = servidor3.docker.containers.run(image="mentz/tcc:latest",
                                         network=config.nwName_macvlan,
                                         command="/root/etg-server",
                                         detach=True)

    # Obter endereço IP dos contêineres na MacVLan
    s1_inspect = servidor1.docker.api.inspect_container(s1.id)
    s1_ip = s1_inspect['NetworkSettings']['Networks'][
        config.nwName_macvlan]['IPAddress']
    s2_inspect = servidor2.docker.api.inspect_container(s2.id)
    s2_ip = s2_inspect['NetworkSettings']['Networks'][
        config.nwName_macvlan]['IPAddress']
    s3_inspect = servidor3.docker.api.inspect_container(s3.id)
    s3_ip = s3_inspect['NetworkSettings']['Networks'][
        config.nwName_macvlan]['IPAddress']

    etgConfig = config.etgConfigDefault.format(s1_ip, s2_ip, s3_ip)

    c1 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_macvlan,
        command=config.etgTestCommand.format(etgConfig, config.etgClientSeed),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup4(c1, s1, s2, s3)
    timePrint("TrafegoDC [DONE]")
Exemplo n.º 2
0
def rodar_host(cliente, servidor1, servidor2, servidor3, logDir):
    #############################################################################
    # TrafegoDC
    timePrint("TrafegoDC [STARTING]")
    s1 = servidor1.docker.containers.run(image="mentz/tcc:latest",
                                         network="host",
                                         command="/root/etg-server",
                                         detach=True)

    s2 = servidor2.docker.containers.run(image="mentz/tcc:latest",
                                         network="host",
                                         command="/root/etg-server",
                                         detach=True)

    s3 = servidor3.docker.containers.run(image="mentz/tcc:latest",
                                         network="host",
                                         command="/root/etg-server",
                                         detach=True)

    etgConfig = config.etgConfigDefault.format(servidor1.ipAddr,
                                               servidor2.ipAddr,
                                               servidor3.ipAddr)

    c1 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command=config.etgTestCommand.format(etgConfig, config.etgClientSeed),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup4(c1, s1, s2, s3)
    timePrint("TrafegoDC [DONE]")
Exemplo n.º 3
0
def rodar_host(cliente, servidor, logDir):
    #############################################################################
    # iPerf TCP
    timePrint("iPerf TCP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network="host",
                                        command="iperf3 -s -p 5201",
                                        detach=True)

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command=
        "iperf3 -i 1 -t %d -c %s -p 5201 -J --logfile /mnt/log/iperf3_tcp.json"
        % (config.testDuration, servidor.ipAddr),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup(c2, c1)
    timePrint("iPerf TCP [DONE]")

    #############################################################################
    # iPerf UDP
    timePrint("iPerf UDP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network="host",
                                        command="iperf3 -s -p 5202",
                                        detach=True)

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command=
        "iperf3 -i 1 -b 0 -t %d -c %s -p 5202 -J --logfile /mnt/log/iperf3_udp.json"
        % (config.testDuration, servidor.ipAddr),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup(c2, c1)
    timePrint("iPerf UDP [DONE]")

    #############################################################################
    # SockPerf Ping-Pong TCP
    timePrint("SockPerf Ping-Pong TCP [STARTING]")
    c1 = servidor.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command="sockperf server -p 11111 --tcp",
        detach=True)

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command=
        "sockperf pp -i %s -t %d --mps=100 --tcp -p 11111 --full-rtt --full-log /mnt/log/sockperf_pp_tcp.csv"
        % (servidor.ipAddr, config.testDuration),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    waitThenCleanup(c2, c1)
    timePrint("SockPerf Ping-Pong TCP [DONE]")

    #############################################################################
    # SockPerf Ping-Pong UDP
    timePrint("SockPerf Ping-Pong UDP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network="host",
                                        command="sockperf server -p 11111",
                                        detach=True)

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network="host",
        command=
        "sockperf pp -i %s -t %d --mps=100 -p 11111 --full-rtt --full-log /mnt/log/sockperf_pp_udp.csv"
        % (servidor.ipAddr, config.testDuration),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    waitThenCleanup(c2, c1)
    timePrint("SockPerf Ping-Pong UDP [DONE]")
Exemplo n.º 4
0
def rodar_overlay(cliente, servidor, logDir):
    #############################################################################
    # iPerf TCP
    timePrint("iPerf TCP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network=config.nwName_overlay,
                                        command="iperf3 -s -p 5201",
                                        detach=True)
    # Obter endereço IP do contêiner
    c1_inspect = servidor.docker.api.inspect_container(c1.id)
    c1_ip = c1_inspect['NetworkSettings']['Networks'][
        config.nwName_overlay]['IPAddress']

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_overlay,
        command=
        "iperf3 -i 1 -t %d -c %s -p 5201 -J --logfile /mnt/log/iperf3_tcp.json"
        % (config.testDuration, c1_ip),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup(c2, c1)
    timePrint("iPerf TCP [DONE]")

    #############################################################################
    # iPerf UDP
    timePrint("iPerf UDP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network=config.nwName_overlay,
                                        command="iperf3 -s -p 5202",
                                        detach=True)
    # Obter endereço IP do contêiner
    c1_inspect = servidor.docker.api.inspect_container(c1.id)
    c1_ip = c1_inspect['NetworkSettings']['Networks'][
        config.nwName_overlay]['IPAddress']

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_overlay,
        command=
        "iperf3 -i 1 -b 0 -t %d -c %s -p 5202 -J --logfile /mnt/log/iperf3_udp.json"
        % (config.testDuration, c1_ip),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    # time.sleep(config.testDuration)
    waitThenCleanup(c2, c1)
    timePrint("iPerf UDP [DONE]")

    #############################################################################
    # SockPerf Ping-Pong TCP
    timePrint("SockPerf Ping-Pong TCP [STARTING]")
    c1 = servidor.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_overlay,
        command="sockperf server -p 11111 --tcp",
        detach=True)
    # Obter endereço IP do contêiner
    c1_inspect = servidor.docker.api.inspect_container(c1.id)
    c1_ip = c1_inspect['NetworkSettings']['Networks'][
        config.nwName_overlay]['IPAddress']

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_overlay,
        command=
        "sockperf pp -i %s -t %d --mps=100 --tcp -p 11111 --full-rtt --full-log /mnt/log/sockperf_pp_tcp.csv"
        % (c1_ip, config.testDuration),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    waitThenCleanup(c2, c1)
    timePrint("SockPerf Ping-Pong TCP [DONE]")

    #############################################################################
    # SockPerf Ping-Pong UDP
    timePrint("SockPerf Ping-Pong UDP [STARTING]")
    c1 = servidor.docker.containers.run(image="mentz/tcc:latest",
                                        network=config.nwName_overlay,
                                        command="sockperf server -p 11111",
                                        detach=True)
    # Obter endereço IP do contêiner
    c1_inspect = servidor.docker.api.inspect_container(c1.id)
    c1_ip = c1_inspect['NetworkSettings']['Networks'][
        config.nwName_overlay]['IPAddress']

    c2 = cliente.docker.containers.run(
        image="mentz/tcc:latest",
        network=config.nwName_overlay,
        command=
        "sockperf pp -i %s -t %d --mps=100 -p 11111 --full-rtt --full-log /mnt/log/sockperf_pp_udp.csv"
        % (c1_ip, config.testDuration),
        volumes={logDir: {
            'bind': '/mnt/log',
            'mode': 'rw'
        }},
        detach=True)

    # Aguardar encerramento do teste
    waitThenCleanup(c2, c1)
    timePrint("SockPerf Ping-Pong UDP [DONE]")