vswitch: interface-reconfigure: bring down physical interfaces
[sliver-openvswitch.git] / tests / ovsdb-data.at
index 708ed90..4bfd909 100644 (file)
@@ -198,7 +198,80 @@ OVSDB_CHECK_NEGATIVE([uuids must be valid],
   [parse-atom-strings '[["uuid"]]' '1234-5678'],
   ["1234-5678" is not a valid UUID])
 \f
-AT_BANNER([OVSDB -- atoms with constraints])
+AT_BANNER([OVSDB -- atoms with enum constraints])
+
+OVSDB_CHECK_POSITIVE([integer atom enum], 
+  [[parse-atoms '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' \
+    '[0]' \
+    '[1]' \
+    '[2]' \
+    '[3]' \
+    '[6]' \
+    '[7]' \
+    '[8]' \
+    '[9]' \
+    '[10]' \
+    '[11]']], 
+  [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10])
+1
+constraint violation: 2 is not one of the allowed values ([1, 6, 8, 10])
+constraint violation: 3 is not one of the allowed values ([1, 6, 8, 10])
+6
+constraint violation: 7 is not one of the allowed values ([1, 6, 8, 10])
+8
+constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10])
+10
+constraint violation: 11 is not one of the allowed values ([1, 6, 8, 10])]])
+
+OVSDB_CHECK_POSITIVE([real atom enum], 
+  [[parse-atoms '[{"type": "real", "enum": ["set", [-1.5, 1.5]]}]' \
+    '[-2]' \
+    '[-1]' \
+    '[-1.5]' \
+    '[0]' \
+    '[1]' \
+    '[1.5]' \
+    '[2]']], 
+  [[constraint violation: -2 is not one of the allowed values ([-1.5, 1.5])
+constraint violation: -1 is not one of the allowed values ([-1.5, 1.5])
+-1.5
+constraint violation: 0 is not one of the allowed values ([-1.5, 1.5])
+constraint violation: 1 is not one of the allowed values ([-1.5, 1.5])
+1.5
+constraint violation: 2 is not one of the allowed values ([-1.5, 1.5])]])
+
+OVSDB_CHECK_POSITIVE([boolean atom enum], 
+  [[parse-atoms '[{"type": "boolean", "enum": false}]' \
+    '[false]' \
+    '[true]']], 
+  [[false
+constraint violation: true is not one of the allowed values ([false])]])
+
+OVSDB_CHECK_POSITIVE([string atom enum], 
+  [[parse-atoms '[{"type": "string", "enum": ["set", ["abc", "def"]]}]' \
+    '[""]' \
+    '["ab"]' \
+    '["abc"]' \
+    '["def"]' \
+    '["defg"]' \
+    '["DEF"]']], 
+  [[constraint violation: "" is not one of the allowed values ([abc, def])
+constraint violation: ab is not one of the allowed values ([abc, def])
+"abc"
+"def"
+constraint violation: defg is not one of the allowed values ([abc, def])
+constraint violation: DEF is not one of the allowed values ([abc, def])]])
+
+OVSDB_CHECK_POSITIVE([uuid atom enum], 
+  [[parse-atoms '[{"type": "uuid", "enum": ["set", [["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"], ["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]]]}]' \
+    '["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"]' \
+    '["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]' \
+    '["uuid", "dab2a6b2-6094-4f43-a7ef-4c0f0608f176"]']], 
+  [[["uuid","6d53a6dd-2da7-4924-9927-97f613812382"]
+["uuid","52cbc842-137a-4db5-804f-9f34106a0ba3"]
+constraint violation: dab2a6b2-6094-4f43-a7ef-4c0f0608f176 is not one of the allowed values ([52cbc842-137a-4db5-804f-9f34106a0ba3, 6d53a6dd-2da7-4924-9927-97f613812382])]])
+\f
+AT_BANNER([OVSDB -- atoms with other constraints])
 
 OVSDB_CHECK_POSITIVE([integers >= 5], 
   [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \
@@ -290,37 +363,6 @@ constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
 constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
 constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
 
-AT_SETUP([strings matching /(a(b)?)c?/])
-AT_KEYWORDS([ovsdb positive])
-if test "$HAVE_PCRE" = yes; then
-   b_out='constraint violation: "b" does not match regular expression /(a(b)?)?c?/'
-   bc_out='constraint violation: "bc" does not match regular expression /(a(b)?)?c?/'
-else
-   b_out='"b"'
-   bc_out='"bc"'
-fi
-AT_CHECK_UNQUOTED(
-  [[test-ovsdb parse-atoms '{"type": "string", "reMatch": "(a(b)?)?c?"}' \
-    '[""]' \
-    '["a"]' \
-    '["ab"]' \
-    '["abc"]' \
-    '["ac"]' \
-    '["b"]' \
-    '["bc"]' \
-    '["c"]']],
-  [0],
-  [[""
-"a"
-"ab"
-"abc"
-"ac"
-$b_out
-$bc_out
-"c"
-]])
-AT_CLEANUP
-
 OVSDB_CHECK_POSITIVE([strings at least 2 characters long],
   [[parse-atoms '{"type": "string", "minLength": 2}' \
     '[""]' \
@@ -350,7 +392,7 @@ constraint violation: "abc" length 3 is greater than maximum allowed length 2
 AT_BANNER([OSVDB -- simple data])
 
 OVSDB_CHECK_POSITIVE([integer JSON datum],
-  [[parse-data '["integer"]' '[0]' '[1]' '[-1]']],
+  [[parse-data '["integer"]' '[0]' '["set",[1]]' '[-1]']],
   [0
 1
 -1])
@@ -363,7 +405,7 @@ OVSDB_CHECK_POSITIVE([integer string datum],
 1])
 
 OVSDB_CHECK_POSITIVE([real JSON datum], 
-  [[parse-data '["real"]' '[0]' '[1.0]' '[-1.25]']],
+  [[parse-data '["real"]' '[0]' '["set",[1.0]]' '[-1.25]']],
   [0
 1
 -1.25])
@@ -375,7 +417,7 @@ OVSDB_CHECK_POSITIVE([real string datum],
 -1.25])
 
 OVSDB_CHECK_POSITIVE([boolean JSON datum],
-  [[parse-data '["boolean"]' '[true]' '[false]' ]],
+  [[parse-data '["boolean"]' '["set", [true]]' '[false]' ]],
   [true
 false])
 
@@ -385,7 +427,7 @@ OVSDB_CHECK_POSITIVE([boolean string datum],
 false])
 
 OVSDB_CHECK_POSITIVE([string JSON datum],
-  [[parse-data '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
+  [[parse-data '["string"]' '["set",[""]]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
   [""
 "true"
 "\"\\/\b\f\n\r\t"])
@@ -401,11 +443,11 @@ AT_BANNER([OVSDB -- set data])
 
 OVSDB_CHECK_POSITIVE([JSON optional boolean],
   [[parse-data '{"key": "boolean", "min": 0}' \
-    '["set", [true]]' \
+    '[true]' \
     '["set", [false]]' \
     '["set", []]']], 
-  [[["set",[true]]
-["set",[false]]
+  [[true
+false
 ["set",[]]]],
   [set])
 
@@ -422,12 +464,14 @@ false
 OVSDB_CHECK_POSITIVE([JSON set of 0 or more integers],
   [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \
     '["set", [0]]' \
+    '[1]' \
     '["set", [0, 1]]' \
     '["set", [0, 1, 2]]' \
     '["set", [0, 1, 2, 3, 4, 5]]' \
     '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \
     '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']],
-  [[["set",[0]]
+  [[0
+1
 ["set",[0,1]]
 ["set",[0,1,2]]
 ["set",[0,1,2,3,4,5]]
@@ -452,10 +496,12 @@ OVSDB_CHECK_POSITIVE([string set of 0 or more integers],
 OVSDB_CHECK_POSITIVE([JSON set of 1 to 3 uuids],
   [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \
     '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \
+    '["uuid", "b5078be0-7664-4299-b836-8bcc03ef941f"]' \
     '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"],
               ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"],
               ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']],
-  [[["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"]]]
+  [[["uuid","550e8400-e29b-41d4-a716-446655440000"]
+["uuid","b5078be0-7664-4299-b836-8bcc03ef941f"]
 ["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]])
 
 OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
@@ -470,11 +516,13 @@ OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
 OVSDB_CHECK_POSITIVE([JSON set of 0 to 3 strings],
   [[parse-data '{"key": "string", "min": 0, "max": 3}' \
     '["set", []]' \
+    '["a longer string"]' \
     '["set", ["a relatively long string"]]' \
     '["set", ["short string", "a relatively long string"]]' \
     '["set", ["zzz", "short string", "a relatively long string"]]']],
   [[["set",[]]
-["set",["a relatively long string"]]
+"a longer string"
+"a relatively long string"
 ["set",["a relatively long string","short string"]]
 ["set",["a relatively long string","short string","zzz"]]]])