Macro can be used to wait for ofport creation in ovsdb and
to retrieve its value.

Signed-off-by: Xavier Simonart <[email protected]>
---
 tests/ovn-macros.at | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 8879c2fa1..2636b34cd 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -1485,6 +1485,16 @@ wake_up_nb() {
   AT_CHECK([kill -CONT $(cat ovn-nb/ovsdb-server.pid)])
 }
 
+wait_and_get_ofport() {
+    local ofport
+    local condition=$1
+    OVS_WAIT_UNTIL([
+        ofport=$(ovs-vsctl --bare --columns ofport find Interface $condition)
+        echo "$condition port=$ofport" >&2
+        test -n "$ofport" && test "$ofport" -ge 0])
+    echo $ofport
+}
+
 trim_zeros() {
     sed 's/\(00\)\{1,\}$//'
 }
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to