On Mon, Jul 8, 2024 at 3:30 PM Dean Marx <dm...@iol.unh.edu> wrote:
>
> Suite for testing ability of Poll Mode Driver to turn promiscuous
> mode on/off, allmulticast mode on/off, and show expected behavior
> when sending packets with known, unknown, broadcast, and multicast
> destination MAC addresses.
>
> Signed-off-by: Dean Marx <dm...@iol.unh.edu>
> ---
>  dts/tests/TestSuite_dynamic_config.py | 149 ++++++++++++++++++++++++++
>  1 file changed, 149 insertions(+)
>  create mode 100644 dts/tests/TestSuite_dynamic_config.py
>
> diff --git a/dts/tests/TestSuite_dynamic_config.py 
> b/dts/tests/TestSuite_dynamic_config.py
> new file mode 100644
> index 0000000000..a6e5384c50
> --- /dev/null
> +++ b/dts/tests/TestSuite_dynamic_config.py
> @@ -0,0 +1,149 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2024 University of New Hampshire
> +
> +"""Dynamic configuration capabilities test suite.
> +
> +This suite checks that it is possible to change the configuration of a port
> +dynamically. The Poll Mode Driver should be able to enable and disable
> +promiscuous mode on each port, as well as check the Rx and Tx packets of
> +each port

It might be worth explaining here more of what specifically is being
checked by the PMD. It seems like there is different expected output
based on whether promisc mode is on or not as well as different
behaviors with different MAC addresses.
.
> +
> +If packets should be received and forwarded, or received and not forwarded,
> +depending on the configuration, the port info should match the expected 
> behavior.
> +"""
<snip>
> +    def test_default_mode(self) -> None:
> +        """Tests default configuration.
> +
> +        Creates a testpmd shell, verifies that promiscuous mode is enabled 
> by default,
> +        and sends two packets; one matching source MAC address and one 
> unknown.
> +        Verifies that both are received.
> +        """
> +        testpmd = TestPmdShell(node=self.sut_node)
> +        isPromisc = testpmd.show_port_info(0).is_promiscuous_mode_enabled
> +        self.verify(isPromisc, "Promiscuous mode was not enabled by 
> default.")
> +        testpmd.start()
> +        mac = testpmd.show_port_info(0).mac_address
> +        # send a packet with Rx port mac address
> +        self.send_packet_and_verify(should_receive=True, 
> mac_address=str(mac))
> +        # send a packet with mismatched mac address
> +        self.send_packet_and_verify(should_receive=True, 
> mac_address="00:00:00:00:00:00")

We should be careful using the MAC address that is all 0s as that is a
special address that is reserved for localhost. I think it would still
work in this case since it wouldn't match the address of the tester's
port anyway, but it might be safer to just make the last digit of this
a 1 regardless.

> +        testpmd.close()
> +        sleep(6)
> +
<snip>
> 2.44.0
>

Reply via email to