コード例 #1
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()
コード例 #2
0
ファイル: test_spec03.py プロジェクト: pokgak/Release-Specs
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()
コード例 #3
0
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)

    check_pktbuf(*nodes)
コード例 #4
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)

    check_pktbuf(*nodes)
コード例 #5
0
def test_task02(riot_ctrl, start_server, expected):
    node = riot_ctrl(0, 'examples/gcoap', Shell, port=TAP)

    node_netif, _ = lladdr(node.ifconfig_list())
    node.ifconfig_add(node_netif, NODE_ULA)

    async def run_task02_server():
        server = await coap_server()
        # kill server after 10 seconds, then it has enough time to respond to
        # first retry
        await asyncio.sleep(10)
        await server.shutdown()

    res = node.coap_get(HOST_ULA, 5683, "/time", confirmable=True)
    time.sleep(1)
    if start_server:
        wait_for_futures([run_task02_server()])
    res = node.riotctrl.term.expect([
        r"gcoap: timeout for msg ID \d+",
        r"gcoap: response Success, code 2.05, \d+ bytes",
    ],
                                    timeout=100)
    assert res == expected
コード例 #6
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)

    check_pktbuf(*nodes)