コード例 #1
0
from riotctrl_shell.gnrc import GNRCICMPv6Echo, GNRCIPv6NIB, GNRCPktbufStats
from riotctrl_shell.netif import Ifconfig

from testutils.native import bridged
from testutils.shell import ping6, lladdr, check_pktbuf

APP = 'examples/gnrc_networking'
pytestmark = pytest.mark.rc_only()


class Shell(Ifconfig, GNRCICMPv6Echo, GNRCPktbufStats, GNRCIPv6NIB):
    pass


@pytest.mark.skipif(not bridged(["tap0", "tap1"]),
                    reason="tap0 and tap1 not bridged")
# nodes passed to riot_ctrl fixture
@pytest.mark.parametrize('nodes', [pytest.param(['native', 'native'])],
                         indirect=['nodes'])
def test_task01(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)
コード例 #2
0
from riotctrl_shell.netif import Ifconfig

from testutils.asyncio import wait_for_futures, timeout_futures
from testutils.native import bridged, bridge, get_ping_cmd, interface_exists
from testutils.shell import ping6, lladdr, check_pktbuf

APP = 'tests/gnrc_udp'
TASK05_NODES = 11
pytestmark = pytest.mark.rc_only()


class Shell(Ifconfig, GNRCICMPv6Echo, GNRCPktbufStats):
    pass


@pytest.mark.skipif(not bridged(["tap0", "tap1"]),
                    reason="tap0 and tap1 not bridged")
# nodes passed to riot_ctrl fixture
@pytest.mark.parametrize('nodes', [pytest.param(['native', 'native'])],
                         indirect=['nodes'])
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

    check_pktbuf(pinged, pinger)