aboutsummaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-10-04 10:31:59 -0700
committerBen Pfaff <blp@nicira.com>2011-10-12 10:14:10 -0700
commitf9e5e5b383e523f2f92c91abf23f4fcd7f3b12a5 (patch)
tree76c7804eebd4d318a8f5c2c80a635e12e55b7ff7 /ovsdb
parent2f98b0b7e77b44e9ff9a57581d7d523ca1c113ab (diff)
vswitchd: Document constraints on keys.
Suggested-by: Justin Pettit <jpettit@nicira.com>
Diffstat (limited to 'ovsdb')
-rwxr-xr-xovsdb/ovsdb-doc.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in
index 6f77702c..5aac1ad1 100755
--- a/ovsdb/ovsdb-doc.in
+++ b/ovsdb/ovsdb-doc.in
@@ -174,8 +174,33 @@ def columnGroupToNroff(table, groupXml):
column = table.columns[name]
if node.hasAttribute('key'):
key = node.attributes['key'].nodeValue
+ if node.hasAttribute('type'):
+ type_string = node.attributes['type'].nodeValue
+ type_json = ovs.json.from_string(str(type_string))
+ if type(type_json) in (str, unicode):
+ raise error.Error("%s %s:%s has invalid 'type': %s"
+ % (table.name, name, key, type_json))
+ type_ = ovs.db.types.BaseType.from_json(type_json)
+ else:
+ type_ = column.type.value
+
nameNroff = "%s : %s" % (name, key)
typeNroff = "optional %s" % column.type.value.toEnglish()
+ if (column.type.value.type == ovs.db.types.StringType and
+ type_.type == ovs.db.types.BooleanType):
+ # This is a little more explicit and helpful than
+ # "containing a boolean"
+ typeNroff += r", either \fBtrue\fR or \fBfalse\fR"
+ else:
+ if type_.type != column.type.value.type:
+ type_english = type_.toEnglish()
+ if type_english[0] in 'aeiou':
+ typeNroff += ", containing an %s" % type_english
+ else:
+ typeNroff += ", containing a %s" % type_english
+ constraints = type_.constraintsToEnglish(escapeNroffLiteral)
+ if constraints:
+ typeNroff += ", %s" % constraints
else:
nameNroff = name
typeNroff = typeAndConstraintsToNroff(column)