@@ -342,6 +342,18 @@ main(int argc, char *argv[])
if (should_service_stop()) {
exiting = true;
}
+ /* Check OVN SB database. */
+ char *new_ovnsb_remote = get_ovnsb_remote(ovs_idl_loop.idl);
+ if (strcmp(ovnsb_remote, new_ovnsb_remote)) {
+ free (ovnsb_remote);
+ ovnsb_remote = new_ovnsb_remote;
+ ovsdb_idl_restroy(ovnsb_idl_loop.idl);
+ ovnsb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
+ ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true));
+ ovsdb_idl_get_initial_snapshot(ovnsb_idl_loop.idl);
+ } else {
+ free (new_ovnsb_remote);
+ }
}
/* It's time to exit. Clean up the databases. */
@@ -107,6 +107,21 @@ check_patches \
'br-int patch-quux-to-baz patch-baz-to-quux' \
'br-int patch-baz-to-quux patch-quux-to-baz'
+# Create an empty database, serve it and switch to it
+# and verify that the OVS patch ports disappear
+# then put it back and verify that they reappear
+ovsdb-tool create $ovs_base/ovn-sb/ovn-sb1.db "$abs_top_srcdir"/ovn/ovn-sb.ovsschema
+as ovn-sb ovsdb-server --detach --pidfile=$ovs_base/ovn-sb/ovsdb-server-2.pid --remote=punix:$ovs_base/ovn-sb/ovn-sb1.sock $ovs_base/ovn-sb/ovn-sb1.db
+ovs-vsctl -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb1.sock
+sleep 1
+check_patches
+ovs-vsctl -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb.sock
+sleep 1
+check_patches \
+ 'br-int patch-quux-to-baz patch-baz-to-quux' \
+ 'br-int patch-baz-to-quux patch-quux-to-baz'
+
+
# Change the logical patch ports to VIFs and verify that the OVS patch
# ports disappear.
AT_CHECK([ovn-sbctl \
@@ -115,5 +130,6 @@ AT_CHECK([ovn-sbctl \
check_patches
# Gracefully terminate ovn-controller
+kill `cat $ovs_base/ovn-sb/ovsdb-server-2.pid`
ovs-appctl -t ovn-controller exit
AT_CLEANUP