+ def disable_promisc_setup(self, testpmd: TestPmdShell, port_id: int) -> TestPmdShell:
+ """Sets up testpmd shell config for cases where promisc mode is disabled.
+
+ Args:
+ testpmd: Testpmd session that is being configured.
+ port_id: Port number to disable promisc mode on.
+
+ Returns:
+ TestPmdShell: interactive testpmd shell object.
I know we chatted about this way back, but I personally don't see the stylistic benefit of returning the Testpmd shell, and rewriting the testpmd instance via the return when calling disable_promisc_setup(). I think it reads cleaner if these methods are void methods. But of course it's functionally the same either way, so I'm being a little pedantic. There is no need to change this now, again particularly with what Luca has suggested we do with testpmd shell going forward.
+ """
+ testpmd.start()
+ testpmd.set_promisc(port=port_id, enable=False)
+ testpmd.set_forward_mode(SimpleForwardingModes.io)
+ return testpmd
+
+ @func_test
+ 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.
+ """
+ with TestPmdShell(node=self.sut_node) as testpmd:
+ isPromisc = testpmd.show_port_info(0).is_promiscuous_mode_enabled
+ self.verify(isPromisc, "Promiscuous mode was not enabled by default.")
isPromisc should be is_promisc
--
2.44.0
I will update the commit to change the camelcase to python variable style and merge. Thank you for the testsuite Dean!