<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Jan 15, 2025 at 11:30 AM Dean Marx <<a href="mailto:dmarx@iol.unh.edu">dmarx@iol.unh.edu</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ def disable_promisc_setup(self, testpmd: TestPmdShell, port_id: int) -> TestPmdShell:<br>
+ """Sets up testpmd shell config for cases where promisc mode is disabled.<br>
+<br>
+ Args:<br>
+ testpmd: Testpmd session that is being configured.<br>
+ port_id: Port number to disable promisc mode on.<br>
+<br>
+ Returns:<br>
+ TestPmdShell: interactive testpmd shell object.<br></blockquote><div><br></div><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ """<br>
+ testpmd.start()<br>
+ testpmd.set_promisc(port=port_id, enable=False)<br>
+ testpmd.set_forward_mode(SimpleForwardingModes.io)<br>
+ return testpmd<br>
+<br>
+ @func_test<br>
+ def test_default_mode(self) -> None:<br>
+ """Tests default configuration.<br>
+<br>
+ Creates a testpmd shell, verifies that promiscuous mode is enabled by default,<br>
+ and sends two packets; one matching source MAC address and one unknown.<br>
+ Verifies that both are received.<br>
+ """<br>
+ with TestPmdShell(node=self.sut_node) as testpmd:<br>
+ isPromisc = testpmd.show_port_info(0).is_promiscuous_mode_enabled<br>
+ self.verify(isPromisc, "Promiscuous mode was not enabled by default.")<br></blockquote><div><br></div><div>isPromisc should be is_promisc</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
-- <br>
2.44.0<br></blockquote><div><br></div><div>I will update the commit to change the camelcase to python variable style and merge. Thank you for the testsuite Dean!</div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div></div></div>