Beispiel #1
0
def test_task04(riot_ctrl):
    node = riot_ctrl(0, APP, Shell)
    node.udp_client_send("fe80::db:b7ec", 1337, count=1000,
                         delay_ms=0, payload=8)
    time.sleep(10)
    assert pktbuf(node).is_empty()
    assert pktbuf(node).is_empty()
def test_task10(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, TASK10_APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, TASK10_APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )

    pinged_netif, pinged_addr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 26)
    assert pinged_addr.startswith("fe80::")
    pinger_netif, _ = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_set(pinger_netif, "channel", 26)

    res = ping6(pinger, pinged_addr,
                count=200, interval=600, packet_size=2048)
    if 10 < res['stats']['packet_loss'] <= 100:
        pytest.xfail(
            "Experimental task. See also "
            # pylint: disable=C0301
            "https://github.com/RIOT-OS/Release-Specs/issues/142#issuecomment-561677974"    # noqa: E501
        )
    assert res['stats']['packet_loss'] < 10

    time.sleep(60)
    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #3
0
def test_task04(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )

    pinged_netif, pinged_addr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 26)
    assert pinged_addr.startswith("fe80::")
    pinger_netif, _ = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_set(pinger_netif, "channel", 26)

    # enforce reconnect to pinged's terminal as connection to it in the IoT-LAB
    # sometimes get's lost silently in the CI after the 15 min of pinging
    # see https://github.com/RIOT-OS/Release-Specs/issues/189
    pinged.stop_term()
    res = ping6(pinger,
                pinged_addr,
                count=10000,
                interval=100,
                packet_size=100)
    assert res['stats']['packet_loss'] < 10

    pinged.start_term()
    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #4
0
def test_task01(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, port='tap0'),
        riot_ctrl(1, APP, Shell, port='tap1'),
    )

    res = ping6(pinger, "ff02::1", count=1000, packet_size=0, interval=10)
    assert res['stats']['packet_loss'] < 1

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #5
0
def test_task05(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )
    pinged_netif, _ = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 17)
    pinger_netif, _ = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_set(pinger_netif, "channel", 17)

    res = ping6(pinger, "ff02::1", count=1000, interval=100, packet_size=50)
    assert res['stats']['packet_loss'] < 10

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #6
0
def test_task03(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, port='tap0'),
        riot_ctrl(1, APP, Shell, port='tap1'),
    )

    _, pinged_addr = lladdr(pinged.ifconfig_list())
    assert pinged_addr.startswith("fe80::")

    res = ping6(pinger, pinged_addr,
                count=3600, interval=1000, packet_size=1024)
    assert res['stats']['packet_loss'] < 1

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #7
0
def test_task05(nodes, riot_ctrl):
    nodes = [
        riot_ctrl(i, APP, Shell, port='tap{}'.format(i))
        for i in range(len(nodes))
    ]

    async def finish_task05(pinger, future):
        await future
        print(pinger.riotctrl.env.get("PORT"), "done")

    _, pinged_addr = lladdr(nodes[0].ifconfig_list())
    assert pinged_addr.startswith("fe80::")

    futures = []
    for pinger in nodes[1:]:
        out = pinger.ping6(pinged_addr,
                           count=100000, interval=0, packet_size=1452,
                           async_=True)
        futures.append(finish_task05(pinger, out))
    wait_for_futures(futures)

    time.sleep(120)
    for node in reversed(nodes):
        # add print to know which node's packet buffer is not empty on error
        print("check pktbuf on", node.riotctrl.env.get("PORT"))
        assert pktbuf(node).is_empty()
Beispiel #8
0
def test_task06(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )
    pinged_netif, pinged_addr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 26)
    assert pinged_addr.startswith("fe80::")
    pinger_netif, _ = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_set(pinger_netif, "channel", 26)

    res = ping6(pinger, pinged_addr, count=1000, interval=100, packet_size=100)
    assert res['stats']['packet_loss'] < 10

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #9
0
def test_task09(riot_ctrl):
    nodes = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(2, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )

    pinged = nodes[0]
    pingers = nodes[1:]

    pinged_netif, pinged_addr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 26)
    assert pinged_addr.startswith("fe80::")
    for pinger in pingers:
        pinger_netif, _ = lladdr(pinger.ifconfig_list())
        pinger.ifconfig_set(pinger_netif, "channel", 26)

    futures = []
    for pinger in nodes[1:]:
        out = pinger.ping6(pinged_addr,
                           count=200,
                           interval=0,
                           packet_size=1232,
                           async_=True)
        futures.append(out)
    wait_for_futures(futures)

    time.sleep(60)
    for node in nodes:
        # add print to know which node's packet buffer is not empty on error
        print("check pktbuf on", node.riotctrl.env.get("PORT"))
        assert pktbuf(node).is_empty()
Beispiel #10
0
def test_task04(riot_ctrl, log_nodes):
    node = riot_ctrl(0, APP, Shell, port='tap0')
    pingers = [pexpect.replwrap.bash() for _ in range(10)]

    _, pinged_addr = lladdr(node.ifconfig_list())
    assert pinged_addr.startswith("fe80::")
    iface = bridge('tap0')
    pinged_addr += "%{}".format(iface)
    ping_cmd = get_ping_cmd()

    futures = []
    try:
        for pinger in pingers:
            if log_nodes:
                pinger.child.logfile = sys.stdout
            out = pinger.run_command("{ping_cmd} -f -s 1452 {pinged_addr}"
                                     # pipe to /dev/null because output can go
                                     # into MiB of data ;-)
                                     " 2>&1 > /dev/null"
                                     .format(ping_cmd=ping_cmd,
                                             pinged_addr=pinged_addr),
                                     async_=True, timeout=60 * 60)
            futures.append(out)
        timeout_futures(futures, 60 * 60)
    finally:
        for pinger in pingers:
            # interrupt prevailing `ping6`s
            pinger.child.sendintr()

    time.sleep(60)
    assert pktbuf(node).is_empty()
Beispiel #11
0
def test_task01(statically_routed_nodes):
    pinger = statically_routed_nodes[0]

    res = ping6(pinger, TO_ADDR, count=100, packet_size=50, interval=100)
    assert res["stats"]["packet_loss"] < 20
    time.sleep(10)
    for node in statically_routed_nodes:
        assert pktbuf(node).is_empty()
Beispiel #12
0
def test_task03(rpl_nodes):
    pinger = rpl_nodes[-1]

    _, root_addr = global_addr(rpl_nodes[0].ifconfig_list())
    res = ping6(pinger, root_addr, count=100, packet_size=50, interval=100)
    assert res["stats"]["packet_loss"] < 20
    time.sleep(10)
    for node in rpl_nodes:
        assert pktbuf(node).is_empty()
Beispiel #13
0
def test_task06(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, port='tap0'),
        riot_ctrl(1, APP, Shell, port='tap1'),
    )

    _, pinged_addr = lladdr(pinged.ifconfig_list())
    assert pinged_addr.startswith("fe80::")

    res = ping6(pinger, pinged_addr,
                count=1000, interval=100, packet_size=2048)
    if 1 <= res['stats']['packet_loss'] < 100:
        pytest.xfail("1 <= packet_loss < 100; "
                     "this test is prone to fail in CI.")
    assert res['stats']['packet_loss'] < 1
    time.sleep(60)

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #14
0
def test_task05(riot_ctrl):
    nodes = (
        riot_ctrl(0, APP, Shell, port="tap0"),
        riot_ctrl(1, APP, Shell, port="tap1"),
    )

    for client, server in zip(nodes, reversed(nodes)):
        _, server_addr = lladdr(server.ifconfig_list())
        assert server_addr.startswith("fe80::")

        server.udp_server_start(1337)

        client.udp_client_send(server_addr, 1337, count=100,
                               delay_ms=100, payload=0)
        packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
        assert packet_loss <= 10
        server.udp_server_stop()

    assert pktbuf(nodes[0]).is_empty()
    assert pktbuf(nodes[1]).is_empty()
Beispiel #15
0
def test_task02(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
    )

    pinged_netif, pinged_lladdr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_add(pinged_netif, "beef::1/64")
    pinger_netif, pinger_lladdr = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_add(pinger_netif, "affe::1/120")

    pinged.nib_route_add(pinged_netif, "::", pinger_lladdr)
    pinger.nib_route_add(pinger_netif, "::", pinged_lladdr)

    res = ping6(pinger, "beef::1", count=100, interval=300, packet_size=1024)
    assert res['stats']['packet_loss'] < 10

    time.sleep(10)
    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #16
0
def test_task04(riot_ctrl):
    pinger, pinged = (
        riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"], port="tap0"),
        riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"], port="tap1"),
    )

    pinged_netif, pinged_lladdr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_flag(pinged_netif, "rtr_adv", False)
    pinged.ifconfig_add(pinged_netif, "beef::1/64")
    pinger_netif, pinger_lladdr = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_flag(pinger_netif, "rtr_adv", False)

    pinged.nib_route_add(pinged_netif, "::", pinger_lladdr)
    pinger.nib_route_add(pinger_netif, "::", pinged_lladdr)

    res = ping6(pinger, "beef::1", count=10, interval=300, packet_size=1024)
    assert res['stats']['packet_loss'] < 1

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
def test_task12(riot_ctrl):
    try:
        pinger, pinged = (
            riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
            riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        )
    except subprocess.CalledProcessError:
        pytest.xfail(
            "Experimental task. See also "
            # pylint: disable=C0301
            "https://github.com/RIOT-OS/Release-Specs/pull/198#issuecomment-758522278"  # noqa: E501
        )
    pinged_netif, _ = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 17)
    pinger_netif, _ = lladdr(pinger.ifconfig_list())
    pinger.ifconfig_set(pinger_netif, "channel", 17)

    res = ping6(pinger, "ff02::1",
                count=1000, interval=100, packet_size=50)
    assert res['stats']['packet_loss'] < 10

    assert pktbuf(pinged).is_empty()
    assert pktbuf(pinger).is_empty()
Beispiel #18
0
def test_task06(riot_ctrl):
    nodes = (
        riot_ctrl(0, APP, Shell),
        riot_ctrl(1, APP, Shell),
    )

    for client, server in zip(nodes, reversed(nodes)):
        server_netif, server_addr = lladdr(server.ifconfig_list())
        server.ifconfig_set(server_netif, "channel", 26)
        assert server_addr.startswith("fe80::")
        client_netif, _ = lladdr(client.ifconfig_list())
        client.ifconfig_set(client_netif, "channel", 26)

        server.udp_server_start(1337)

        client.udp_client_send(server_addr, 1337, count=100,
                               delay_ms=100, payload=0)
        packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
        assert packet_loss <= 10
        server.udp_server_stop()

    assert pktbuf(nodes[0]).is_empty()
    assert pktbuf(nodes[1]).is_empty()
Beispiel #19
0
def test_task02(statically_routed_nodes):
    nodes = statically_routed_nodes
    for client, server, server_addr in [(nodes[0], nodes[-1], TO_ADDR),
                                        (nodes[-1], nodes[0], FROM_ADDR)]:
        server.udp_server_start(1337)

        client.udp_client_send(server_addr,
                               1337,
                               count=100,
                               delay_ms=100,
                               payload=50)
        packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
        assert packet_loss < 10
        server.udp_server_stop()
    time.sleep(10)
    for node in statically_routed_nodes:
        assert pktbuf(node).is_empty()
Beispiel #20
0
def test_task04(rpl_nodes):
    nodes = rpl_nodes
    for client, server in [(nodes[0], nodes[-1]), (nodes[-1], nodes[0])]:
        server.udp_server_start(1337)
        _, server_addr = global_addr(server.ifconfig_list())

        client.udp_client_send(server_addr,
                               1337,
                               count=100,
                               delay_ms=100,
                               payload=50)
        packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
        assert packet_loss < 10
        server.udp_server_stop()
    time.sleep(10)
    for node in rpl_nodes:
        assert pktbuf(node).is_empty()
Beispiel #21
0
def test_task05(rpl_nodes):
    nodes = rpl_nodes
    for client, server in [(nodes[0], nodes[-1]), (nodes[-1], nodes[0])]:
        server.udp_server_start(1337)
        _, server_addr = global_addr(server.ifconfig_list())

        client.udp_client_send(server_addr,
                               1337,
                               count=100,
                               delay_ms=1000,
                               payload=2048)
        packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
        if packet_loss >= 10:
            pytest.xfail(
                "packet_loss {} >= 10. This is an experimental task, see also "
                # pylint: disable=C0301
                "https://github.com/RIOT-OS/Release-Specs/issues/142#issuecomment-561677974"  # noqa: E501
                .format(packet_loss))
        assert packet_loss < 10
        server.udp_server_stop()
    time.sleep(10)
    for node in rpl_nodes:
        assert pktbuf(node).is_empty()
def test_task11(riot_ctrl):
    try:
        nodes = (
            riot_ctrl(0, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
            riot_ctrl(1, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
            riot_ctrl(2, APP, Shell, modules=["gnrc_pktbuf_cmd"]),
        )
    except subprocess.CalledProcessError:
        pytest.xfail(
            "Experimental task. See also "
            # pylint: disable=C0301
            "https://github.com/RIOT-OS/Release-Specs/pull/198#issuecomment-758522278"  # noqa: E501
        )

    pinged = nodes[0]
    pingers = nodes[1:]

    pinged_netif, pinged_addr = lladdr(pinged.ifconfig_list())
    pinged.ifconfig_set(pinged_netif, "channel", 26)
    assert pinged_addr.startswith("fe80::")
    for pinger in pingers:
        pinger_netif, _ = lladdr(pinger.ifconfig_list())
        pinger.ifconfig_set(pinger_netif, "channel", 26)

    futures = []
    for pinger in nodes[1:]:
        out = pinger.ping6(pinged_addr,
                           count=200, interval=0, packet_size=1232,
                           async_=True)
        futures.append(out)
    wait_for_futures(futures)

    time.sleep(60)
    for node in nodes:
        # add print to know which node's packet buffer is not empty on error
        print("check pktbuf on", node.riotctrl.env.get("PORT"))
        assert pktbuf(node).is_empty()