ovsdb: Add support for weak references.
[sliver-openvswitch.git] / tests / ovsdb-monitor.at
index 16e2471..0f29a05 100644 (file)
@@ -1,6 +1,6 @@
 AT_BANNER([OVSDB -- ovsdb-server monitors])
 
-# OVSDB_CHECK_MONITOR(TITLE, SCHEMA, [PRE-MONITOR-TXN], MONITOR-ARGS,
+# OVSDB_CHECK_MONITOR(TITLE, SCHEMA, [PRE-MONITOR-TXN], DB, TABLE,
 #                     TRANSACTIONS, OUTPUT, [KEYWORDS])
 #
 # Creates a database with the given SCHEMA, starts an ovsdb-server on
@@ -17,29 +17,29 @@ AT_BANNER([OVSDB -- ovsdb-server monitors])
 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
 m4_define([OVSDB_CHECK_MONITOR], 
   [AT_SETUP([$1])
-   AT_KEYWORDS([ovsdb server monitor positive $7])
+   AT_KEYWORDS([ovsdb server monitor positive $8])
    AT_DATA([schema], [$2
 ])
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
    m4_foreach([txn], [$3],
      [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])])
    AT_CHECK([ovsdb-server --detach --pidfile=$PWD/server-pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
-   AT_CHECK([ovsdb-client --detach --pidfile=$PWD/client-pid -d json monitor --format=csv unix:socket ordinals $4 > output], 
+   AT_CHECK([ovsdb-client --detach --pidfile=$PWD/client-pid -d json monitor --format=csv unix:socket $4 $5 > output], 
             [0], [ignore], [ignore], [kill `cat server-pid`])
-   m4_foreach([txn], [$5],
+   m4_foreach([txn], [$6],
      [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0],
                      [ignore], [ignore], [kill `cat server-pid client-pid`])])
-   AT_CHECK([ovsdb-client transact unix:socket '[[]]'], [0],
+   AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0],
             [ignore], [ignore], [kill `cat server-pid client-pid`])
    AT_CHECK([ovs-appctl -t $PWD/unixctl -e exit], [0], [ignore], [ignore])
    OVS_WAIT_UNTIL([test ! -e server-pid && test ! -e client-pid])
-   AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$6], [ignore])
+   AT_CHECK([perl $srcdir/ovsdb-monitor-sort.pl < output | perl $srcdir/uuidfilt.pl], [0], [$7], [ignore])
    AT_CLEANUP])
 
 OVSDB_CHECK_MONITOR([monitor insert into empty table],
   [ORDINAL_SCHEMA],
   [],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "insert",
        "table": "ordinals",
@@ -54,7 +54,7 @@ OVSDB_CHECK_MONITOR([monitor insert into populated table],
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "insert",
        "table": "ordinals",
@@ -72,7 +72,7 @@ OVSDB_CHECK_MONITOR([monitor delete],
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "delete",
        "table": "ordinals",
@@ -90,7 +90,7 @@ OVSDB_CHECK_MONITOR([monitor row update],
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "update",
        "table": "ordinals",
@@ -110,7 +110,7 @@ OVSDB_CHECK_MONITOR([monitor no-op row updates],
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "update",
        "table": "ordinals",
@@ -133,7 +133,7 @@ OVSDB_CHECK_MONITOR([monitor insert-and-update transaction],
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "insert",
        "table": "ordinals",
@@ -150,14 +150,13 @@ row,action,name,number,_version
 <2>,insert,"""three squared""",9,"[""uuid"",""<3>""]"
 ]])
 
-
 OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction],
   [ORDINAL_SCHEMA],
   [[[["ordinals",
       {"op": "insert",
        "table": "ordinals",
        "row": {"number": 10, "name": "ten"}}]]]],
-  [ordinals],
+  [ordinals], [ordinals],
   [[[["ordinals",
       {"op": "insert",
        "table": "ordinals",
@@ -180,3 +179,38 @@ row,action,name,number,_version
 <2>,insert,"""seven""",7,"[""uuid"",""<3>""]"
 ]])
 
+OVSDB_CHECK_MONITOR([monitor weak reference change],
+  [WEAK_SCHEMA],
+  [[[["weak",
+      {"op": "insert",
+       "table": "a",
+       "row": {"a": 0,
+               "a2a1": ["named-uuid", "a0"],
+               "a2b": ["named-uuid", "b2"]},
+       "uuid-name": "a0"},
+      {"op": "insert",
+       "table": "a",
+       "row": {"a": 1,
+               "a2a": ["named-uuid", "a0"],
+               "a2a1": ["named-uuid", "a1"],
+               "a2b": ["named-uuid", "b2"]},
+       "uuid-name": "a1"},
+      {"op": "insert",
+       "table": "b",
+       "row": {"b": 2},
+       "uuid-name": "b2"}]]]],
+  [weak], [a],
+  [[[["weak",
+      {"op": "delete",
+       "table": "a",
+       "where": [["a", "==", 0]]}]]]],
+  [[row,action,a,a2a,a2b,a2a1,_version
+<0>,initial,0,"[""set"",[]]","[""uuid"",""<1>""]","[""uuid"",""<0>""]","[""uuid"",""<2>""]"
+<3>,initial,1,"[""uuid"",""<0>""]","[""uuid"",""<1>""]","[""uuid"",""<3>""]","[""uuid"",""<4>""]"
+
+row,action,a,a2a,a2b,a2a1,_version
+<0>,delete,0,"[""set"",[]]","[""uuid"",""<1>""]","[""uuid"",""<0>""]","[""uuid"",""<2>""]"
+<3>,old,,"[""uuid"",""<0>""]",,,
+,new,1,"[""set"",[]]","[""uuid"",""<1>""]","[""uuid"",""<3>""]","[""uuid"",""<5>""]"
+]])
+