`ovn-sbctl lflow-list` and `ovn-sbctl count-lflows` can accept the UUID
of a northbound logical datapath as its argument. We didn't have
anything that tested that this works properly, so this fills the gap by
extending the existing count-flows test. We ensure that when we count
the logical switch's flows using the logical switch UUID, we get the
same results as we did when we counted using the name.

Signed-off-by: Mark Michelson <mmich...@redhat.com>
---
 tests/ovn-sbctl.at | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at
index c1ec79dc4..cb2fd2d0a 100644
--- a/tests/ovn-sbctl.at
+++ b/tests/ovn-sbctl.at
@@ -257,6 +257,18 @@ AT_CHECK_UNQUOTED([ovn-sbctl count-flows count-test | grep 
Total | grep ingress
 $ingress_lflows
 ])
 
+# check total logical flows in a specific datapath using NB UUID instead of 
name.
+count_test_uuid=$(fetch_column nb:Logical_Switch _uuid name=count-test)
+AT_CHECK_UNQUOTED([ovn-sbctl count-flows $count_test_uuid | grep "flows =" | 
awk 'NF>1{print $NF}'], [0], [dnl
+$total_lflows
+])
+AT_CHECK_UNQUOTED([ovn-sbctl count-flows $count_test_uuid | grep Total | grep 
egress | awk 'NF>1{print $NF}'], [0], [dnl
+$egress_lflows
+])
+AT_CHECK_UNQUOTED([ovn-sbctl count-flows $count_test_uuid | grep Total | grep 
ingress | awk 'NF>1{print $NF}'], [0], [dnl
+$ingress_lflows
+])
+
 # check nonexistent datapath
 AT_CHECK([ovn-sbctl count-flows wrongDatapath], [0], [dnl
 Total number of logical flows = 0
-- 
2.49.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to