# limitations under the License.
import sys
+import uuid
from ovs.db import error
import ovs.db.parser
import ovs.ovsuuid
class AtomicType(object):
- def __init__(self, name, default):
+ def __init__(self, name, default, python_types):
self.name = name
self.default = default
+ self.python_types = python_types
@staticmethod
def from_string(s):
def default_atom(self):
return ovs.db.data.Atom(self, self.default)
-VoidType = AtomicType("void", None)
-IntegerType = AtomicType("integer", 0)
-RealType = AtomicType("real", 0.0)
-BooleanType = AtomicType("boolean", False)
-StringType = AtomicType("string", "")
-UuidType = AtomicType("uuid", ovs.ovsuuid.zero())
+VoidType = AtomicType("void", None, ())
+IntegerType = AtomicType("integer", 0, (int, long))
+RealType = AtomicType("real", 0.0, (int, long, float))
+BooleanType = AtomicType("boolean", False, (bool,))
+StringType = AtomicType("string", "", (str, unicode))
+UuidType = AtomicType("uuid", ovs.ovsuuid.zero(), (uuid.UUID,))
ATOMIC_TYPES = [VoidType, IntegerType, RealType, BooleanType, StringType,
UuidType]