From: emohandesi@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: sjg@chromium.org, mario.six@gdsys.cc, joe.hershberger@ni.com,
rfried.dev@gmail.com, xypron.glpk@gmx.de,
ilias.apalodimas@linaro.org, masahisa.kojima@linaro.org,
pali@kernel.org, tobias@waldekranz.com, john@metanate.com,
v.v.mitrofanov@yadro.com, saproj@gmail.com
Subject: [PATCH v4 2/3] test/py: IPv6 network discovery test
Date: Fri, 21 Apr 2023 17:08:22 -0700 [thread overview]
Message-ID: <1682122103-21466-3-git-send-email-emohandesi@linux.microsoft.com> (raw)
In-Reply-To: <1682122103-21466-1-git-send-email-emohandesi@linux.microsoft.com>
From: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Test the IPv6 network discovery feature if indicated by boardenv file.
Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
---
configs/sandbox64_defconfig | 2 ++
configs/sandbox_defconfig | 2 ++
configs/sandbox_flattree_defconfig | 2 ++
test/py/tests/test_net.py | 31 ++++++++++++++++++++++++++++++-
4 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index af2c56a..be36ede 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -260,3 +260,5 @@ CONFIG_FWU_MULTI_BANK_UPDATE=y
CONFIG_UNIT_TEST=y
CONFIG_UT_TIME=y
CONFIG_UT_DM=y
+CONFIG_IPV6=y
+CONFIG_IPV6_ROUTER_DISCOVERY=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index ca95b2c..0673c69 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -341,3 +341,5 @@ CONFIG_UNIT_TEST=y
CONFIG_UT_TIME=y
CONFIG_UT_DM=y
CONFIG_CMD_2048=y
+CONFIG_IPV6=y
+CONFIG_IPV6_ROUTER_DISCOVERY=y
diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig
index e9fcc5b..d6c8dd2 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -229,3 +229,5 @@ CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
CONFIG_UNIT_TEST=y
CONFIG_UT_TIME=y
CONFIG_UT_DM=y
+CONFIG_IPV6=y
+CONFIG_IPV6_ROUTER_DISCOVERY=y
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 9ca6743..f85071d 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:
@@ -55,6 +55,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
@@ -126,6 +131,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.
--
1.8.3.1
next prev parent reply other threads:[~2023-04-22 0:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 16:58 [PATCH] net: ipv6: Add support for default gateway discovery emohandesi
2023-03-16 8:47 ` Vyacheslav V. Mitrofanov
2023-03-23 16:44 ` Ehsan Mohandesi
2023-03-23 16:59 ` Vyacheslav V. Mitrofanov
2023-04-01 19:02 ` Ramon Fried
2023-04-10 19:34 ` [PATCH v2 0/4] Add IPv6 Network Discovery emohandesi
2023-04-10 19:34 ` [PATCH v2 1/4] Revert "net: ipv6: Add support for default gateway discovery." emohandesi
2023-04-11 7:01 ` Vyacheslav V. Mitrofanov
2023-04-11 14:51 ` Ehsan Mohandesi
2023-04-10 19:34 ` [PATCH v2 2/4] net: ipv6: Add support for default gateway discovery emohandesi
2023-04-10 19:34 ` [PATCH v2 3/4] test/py: IPv6 network discovery test emohandesi
2023-04-10 19:34 ` [PATCH v2 4/4] test: eth: IPv6 network discovery unit test emohandesi
2023-04-12 16:10 ` [PATCH v3 0/3] Add IPv6 Network Discovery emohandesi
2023-04-12 16:10 ` [PATCH v3 1/3] net: ipv6: Add support for default gateway discovery emohandesi
2023-04-20 13:44 ` Vyacheslav V. Mitrofanov
2023-04-12 16:10 ` [PATCH v3 2/3] test/py: IPv6 network discovery test emohandesi
2023-04-19 1:46 ` Simon Glass
2023-04-12 16:10 ` [PATCH v3 3/3] test: eth: IPv6 network discovery unit test emohandesi
2023-04-19 1:46 ` Simon Glass
2023-04-22 0:08 ` [PATCH v4 0/3] Add IPv6 Network Discovery emohandesi
2023-04-22 0:08 ` [PATCH v4 1/3] net: ipv6: Add support for default gateway discovery emohandesi
2023-04-24 7:58 ` Vyacheslav V. Mitrofanov
2023-04-24 8:03 ` Vyacheslav V. Mitrofanov
2023-05-04 14:30 ` Sergei Antonov
2023-05-04 14:52 ` Sergei Antonov
2023-05-05 14:13 ` Ehsan Mohandesi
2023-05-06 14:53 ` Tom Rini
2023-05-10 10:05 ` Sergei Antonov
2023-05-10 11:16 ` Vyacheslav V. Mitrofanov
2023-04-22 0:08 ` emohandesi [this message]
2023-04-24 7:59 ` [PATCH v4 2/3] test/py: IPv6 network discovery test Vyacheslav V. Mitrofanov
2023-05-06 14:53 ` Tom Rini
2023-04-22 0:08 ` [PATCH v4 3/3] test: eth: IPv6 network discovery unit test emohandesi
2023-04-24 8:01 ` Vyacheslav V. Mitrofanov
2023-05-06 14:53 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1682122103-21466-3-git-send-email-emohandesi@linux.microsoft.com \
--to=emohandesi@linux.microsoft.com \
--cc=ilias.apalodimas@linaro.org \
--cc=joe.hershberger@ni.com \
--cc=john@metanate.com \
--cc=mario.six@gdsys.cc \
--cc=masahisa.kojima@linaro.org \
--cc=pali@kernel.org \
--cc=rfried.dev@gmail.com \
--cc=saproj@gmail.com \
--cc=sjg@chromium.org \
--cc=tobias@waldekranz.com \
--cc=u-boot@lists.denx.de \
--cc=v.v.mitrofanov@yadro.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).