diff options
author | Ehsan Mohandesi <emohandesi@linux.microsoft.com> | 2023-04-21 17:08:22 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-05-05 17:59:19 -0400 |
commit | eafbe16b01911daf742acc972581773201852b67 (patch) | |
tree | 12633e45ccf25336654f8f09a04ce0d2002e796a | |
parent | 6de98b60ba89fb96a3adada11a5b5406f3b3786b (diff) | |
download | u-boot-eafbe16b01911daf742acc972581773201852b67.zip u-boot-eafbe16b01911daf742acc972581773201852b67.tar.gz u-boot-eafbe16b01911daf742acc972581773201852b67.tar.bz2 |
test/py: IPv6 network discovery test
Test the IPv6 network discovery feature if indicated by boardenv file.
Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
-rw-r--r-- | configs/sandbox64_defconfig | 1 | ||||
-rw-r--r-- | configs/sandbox_defconfig | 1 | ||||
-rw-r--r-- | configs/sandbox_flattree_defconfig | 1 | ||||
-rw-r--r-- | test/py/tests/test_net.py | 31 |
4 files changed, 33 insertions, 1 deletions
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index f5cfdc4..f3002de 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -69,6 +69,7 @@ CONFIG_CMD_CDP=y CONFIG_CMD_SNTP=y CONFIG_CMD_DNS=y CONFIG_CMD_LINK_LOCAL=y +CONFIG_IPV6_ROUTER_DISCOVERY=y CONFIG_CMD_ETHSW=y CONFIG_CMD_BMP=y CONFIG_CMD_EFIDEBUG=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index b775bf5..1ec44d5 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -101,6 +101,7 @@ CONFIG_CMD_CDP=y CONFIG_CMD_SNTP=y CONFIG_CMD_DNS=y CONFIG_CMD_LINK_LOCAL=y +CONFIG_IPV6_ROUTER_DISCOVERY=y CONFIG_CMD_ETHSW=y CONFIG_CMD_2048=y CONFIG_CMD_BMP=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 5b6b28a..e7657d4 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -59,6 +59,7 @@ CONFIG_CMD_CDP=y CONFIG_CMD_SNTP=y CONFIG_CMD_DNS=y CONFIG_CMD_LINK_LOCAL=y +CONFIG_IPV6_ROUTER_DISCOVERY=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index 0447c0b..cd4b4dc 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -9,7 +9,7 @@ import u_boot_utils """ Note: This test relies on boardenv_* containing configuration values to define -which the network environment available for testing. Without this, this test +which network environment is available for testing. Without this, this test will be automatically skipped. For example: @@ -60,6 +60,11 @@ env__net_nfs_readable_file = { 'size': 5058624, 'crc32': 'c2244b26', } + +# True if a router advertisement service is connected to the network, and should +# be tested. If router advertisement testing is not possible or desired, this +variable may be omitted or set to False. +env__router_on_net = True """ net_set_up = False @@ -151,6 +156,30 @@ def test_net_ping(u_boot_console): output = u_boot_console.run_command('ping $serverip') assert 'is alive' in output +@pytest.mark.buildconfigspec('IPV6_ROUTER_DISCOVERY') +def test_net_network_discovery(u_boot_console): + """Test the network discovery feature of IPv6. + + An IPv6 network command (ping6 in this case) is run to make U-Boot send a + router solicitation packet, receive a router advertisement message, and + parse it. + A router advertisement service needs to be running for this test to succeed. + U-Boot receives the RA, processes it, and if successful, assigns the gateway + IP and prefix length. + The configuration is provided by the boardenv_* file; see the comment at + the beginning of this file. + """ + + router_on_net = u_boot_console.config.env.get('env__router_on_net', False) + if not router_on_net: + pytest.skip('No router on network') + + fake_host_ip = 'fe80::215:5dff:fef6:2ec6' + output = u_boot_console.run_command('ping6 ' + fake_host_ip) + assert 'ROUTER SOLICITATION 1' in output + assert 'Set gatewayip6:' in output + assert '0000:0000:0000:0000:0000:0000:0000:0000' not in output + @pytest.mark.buildconfigspec('cmd_net') def test_net_tftpboot(u_boot_console): """Test the tftpboot command. |