summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/hw/nk_netns.py
blob: 8b7ab75aa27fa8638db6a0506e97d1601dddfa73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0

"""
Test exercising NetDrvContEnv() itself, a NetDrvContEnv() selftest.
"""

from lib.py import ksft_run, ksft_exit
from lib.py import NetDrvContEnv
from lib.py import cmd


def test_ping(cfg) -> None:
    """ Run ping between the container and the remote system. """
    cfg.require_ipver("6")

    cmd(f"ping -c 1 -W5 {cfg.nk_guest_ipv6}", host=cfg.remote)
    cmd(f"ping -c 1 -W5 {cfg.remote_addr_v['6']}", ns=cfg.netns)


def main() -> None:
    """ Ksft boiler plate main """
    with NetDrvContEnv(__file__) as cfg:
        ksft_run([test_ping], args=(cfg,))
    ksft_exit()


if __name__ == "__main__":
    main()