From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F4ECC7619A for ; Wed, 12 Apr 2023 16:11:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8632985F77; Wed, 12 Apr 2023 18:11:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="FPhwkgqI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 683FF85F44; Wed, 12 Apr 2023 18:10:57 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by phobos.denx.de (Postfix) with ESMTP id 74BF685E88 for ; Wed, 12 Apr 2023 18:10:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=emohandesi@linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 3EC6421779D2; Wed, 12 Apr 2023 09:10:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3EC6421779D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681315850; bh=+nfNR0k+qQmxGHsc2yvb0LLNlO9Kub+QEuX2Z5WFCqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPhwkgqIC+C3poUlw3D44JG72JWxx3+rpQc6E0gfvpZSyoulJJnEJYhhi1lbCZZ8u Bb4HGYqwhCNBVew3+ggZxbJAghhK4v98FVQqk75yuC1P97/8d26oASuvmvOVcOyl9/ a1lHDGhKUgXO0yQdTvElwfOuCDEXjfT1M7zHtPpI= 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, tobias@waldekranz.com, john@metanate.com, v.v.mitrofanov@yadro.com, saproj@gmail.com Subject: [PATCH v3 2/3] test/py: IPv6 network discovery test Date: Wed, 12 Apr 2023 09:10:04 -0700 Message-Id: <1681315805-15504-3-git-send-email-emohandesi@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681315805-15504-1-git-send-email-emohandesi@linux.microsoft.com> References: <1677776290-11067-1-git-send-email-emohandesi@linux.microsoft.com> <1681315805-15504-1-git-send-email-emohandesi@linux.microsoft.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Ehsan Mohandesi Test the IPv6 network discovery feature if indicated by boardenv file. Signed-off-by: Ehsan Mohandesi Conflicts: configs/sandbox64_defconfig configs/sandbox_defconfig configs/sandbox_flattree_defconfig --- 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