netdev: Assert that the type of a new network device is correct.
[openvswitch] / tests / test-ovsdb.c
index 04db65421a29ff1a03b65c2572af4735e2919782..5a5a9083d4525b6e10e489f53e32a45b678e1870 100644 (file)
@@ -1468,8 +1468,7 @@ do_transact_print(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
     n_rows = hmap_count(&do_transact_table->rows);
     rows = xmalloc(n_rows * sizeof *rows);
     i = 0;
-    HMAP_FOR_EACH (row, struct ovsdb_row, hmap_node,
-                   &do_transact_table->rows) {
+    HMAP_FOR_EACH (row, hmap_node, &do_transact_table->rows) {
         rows[i++] = row;
     }
     assert(i == n_rows);
@@ -1780,9 +1779,36 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step)
                           "i=%d", atoi(arg1));
             }
             idltest_simple_delete(s);
+        } else if (!strcmp(name, "verify")) {
+            const struct idltest_simple *s;
+
+            if (!arg2 || arg3) {
+                ovs_fatal(0, "\"verify\" command requires 2 arguments");
+            }
+
+            s = idltest_find_simple(idl, atoi(arg1));
+            if (!s) {
+                ovs_fatal(0, "\"verify\" command asks for nonexistent "
+                          "i=%d", atoi(arg1));
+            }
+
+            if (!strcmp(arg2, "i")) {
+                idltest_simple_verify_i(s);
+            } else if (!strcmp(arg2, "b")) {
+                idltest_simple_verify_b(s);
+            } else if (!strcmp(arg2, "s")) {
+                idltest_simple_verify_s(s);
+            } else if (!strcmp(arg2, "u")) {
+                idltest_simple_verify_s(s);
+            } else if (!strcmp(arg2, "r")) {
+                idltest_simple_verify_r(s);
+            } else {
+                ovs_fatal(0, "\"verify\" command asks for unknown column %s",
+                          arg2);
+            }
         } else if (!strcmp(name, "increment")) {
             if (!arg2 || arg3) {
-                ovs_fatal(0, "\"set\" command requires 2 arguments");
+                ovs_fatal(0, "\"increment\" command requires 2 arguments");
             }
             ovsdb_idl_txn_increment(txn, arg1, arg2, NULL);
             increment = true;