On 8/15/25 7:51 PM, Ilya Maximets wrote: > On 8/15/25 6:00 PM, Alexandra Rukomoinikova wrote: >> The new --filter option accepts comma-separated rules to display >> only matching chassis, ports or encapsulation types. >> >> Includes test cases and man page updates. >> >> Signed-off-by: Alexandra Rukomoinikova <[email protected]> >> --- >> NEWS | 3 +++ >> tests/ovn-sbctl.at | 48 +++++++++++++++++++++++++++++++++++++++ >> utilities/ovn-sbctl.8.xml | 12 +++++++++- >> 3 files changed, 62 insertions(+), 1 deletion(-) >> >> diff --git a/NEWS b/NEWS >> index 0cce1790d..6478e75fb 100644 >> --- a/NEWS >> +++ b/NEWS >> @@ -41,6 +41,9 @@ Post v25.03.0 >> - Added support for running tests from the 'check-kernel' system test >> target >> under retis by setting OVS_TEST_WITH_RETIS=yes. See the 'Testing' >> section >> of the documentation for more details. >> + - ovn-sbctl: >> + * Added --filter option that allows filtering the command output based >> + on the specified filter. > > May remove the 'based on the specified filter.' part, it doesn't give any > meaningful information. It's better to add something like 'See ovn-sbctl(8) > for more details.' instead. > > This also needs a slight rebase due to all the patches merged yesterday and > today. > >> >> OVN v25.03.0 - 07 Mar 2025 >> -------------------------- >> diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at >> index cb2fd2d0a..b024fae28 100644 >> --- a/tests/ovn-sbctl.at >> +++ b/tests/ovn-sbctl.at >> @@ -183,6 +183,54 @@ options : {vtep_logical_switch=l0, >> vtep_physical_switch=p0} >> >> dnl --------------------------------------------------------------------- >> >> +OVN_SBCTL_TEST([ovn_sbctl_show_filter_option], [ovn-sbctl show filter >> option], [ >> + >> +AT_CHECK([ovn-nbctl ls-add br-test]) >> +AT_CHECK([ovn-nbctl lsp-add br-test vif0]) >> +AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02]) >> +AT_CHECK([ovn-sbctl chassis-add ch0 geneve 1.2.3.1]) >> +AT_CHECK([ovn-nbctl --wait=sb sync]) >> +AT_CHECK([ovn-sbctl lsp-bind vif0 ch0]) >> + >> +AT_CHECK([ovn-sbctl show], [0], [dnl >> +Chassis ch0 >> + Encap geneve >> + ip: "1.2.3.1" >> + options: {csum="true} > > Somehow the closing quote got lost and the tests are failing. > >> + Port_Binding vif0 >> +]) >> + >> +AT_CHECK([ovn-sbctl chassis-add ch2 geneve 1.2.3.2]) >> +AT_CHECK([ovn-sbctl chassis-add ch3 geneve 1.2.3.3]) >> +AT_CHECK([ovn-sbctl chassis-add ch4 vxlan 1.2.3.4]) >> + >> +AT_CHECK([ovn-sbctl --filter='ch2,ch3' show | grep Chassis | sort], [0], >> [dnl >> +Chassis ch2 >> +Chassis ch3 >> +]) >> + >> +AT_CHECK([ovn-sbctl --filter='1.2.3.4,1.2.3.3' show | grep Chassis | sort], >> [0], [dnl >> +Chassis ch3 >> +Chassis ch4 >> +]) >> + >> +AT_CHECK([ovn-sbctl --filter='Encap(vxlan)' show | grep -E >> '(Chassis|Encap)' | sort], [0], [dnl >> + Encap vxlan >> +Chassis ch0 >> +Chassis ch2 >> +Chassis ch3 >> +Chassis ch4 >> +]) >> + >> +AT_CHECK([ovn-sbctl --filter='Encap(vxlan),ch4' show | grep -E >> '(Chassis|Encap)' | sort], [0], [dnl >> + Encap vxlan >> +Chassis ch4 >> +]) >> + >> +]) >> + >> +dnl --------------------------------------------------------------------- >> + >> OVN_SBCTL_TEST([ovn_sbctl_connection], [ovn-sbctl - connection], [ >> AT_CHECK([ovn-sbctl --inactivity-probe=30000 set-connection >> ptcp:6641:127.0.0.1 punix:$OVS_RUNDIR/ovnsb_db.sock]) >> AT_CHECK([ovn-sbctl list connection | grep inactivity_probe], [0], [dnl >> diff --git a/utilities/ovn-sbctl.8.xml b/utilities/ovn-sbctl.8.xml >> index 69ae62115..3df335e36 100644 >> --- a/utilities/ovn-sbctl.8.xml >> +++ b/utilities/ovn-sbctl.8.xml >> @@ -279,9 +279,19 @@ >> been initialized, this command has no effect. >> </dd> >> >> - <dt><code>show</code></dt> >> + <dt> >> + >> [<code>--filter=<var>filter-rule</var>[,<var>filter-rule</var>...]</code>] > > The closing bracket should be before the '...', also we need to close the > <code> > right after the '--filter=', so all the brackets are not highlighted in bold. > i.e.: > > > [<code>--filter=</code><var>filter-rule</var>[,<var>filter-rule</var>]...] > >> + <code>show</code> >> + </dt> >> <dd> >> Prints a brief overview of the database contents. >> + If <code>--filter</code> is specified, output is filtered according >> to >> + the rules. Each <var>filter-rule</var> has the form >> + >> <code><var>table-name</var>(<var>filter</var>[|<var>filter</var>]...)</code>. > > Here the <code> part only messes up fonts for all the braces and other stuff, > so it's better to just drop it, i.e.: > > <var>table-name</var>(<var>filter</var>[|<var>filter</var>]...). > > >> + If <var>table-name</var> is omitted, filtering is applied to >> + the <code>Chassis</code> table by default. A row is shown only if >> its >> + printed representation (including all referenced rows) contains at >> + least one of the specified <var>filter</var> substrings. >> </dd> >> </dl> >> >
FWIW, if maintainers are willing to make these changes themselves (and the submodule hash change from the patch 1), just to save some time on iterations, then they can add my Ack to both patches: Acked-by: Ilya Maximets <[email protected]> _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
