From: Ben Pfaff Date: Tue, 24 May 2011 19:32:01 +0000 (-0700) Subject: ovsdb: Annotate E-R diagram with number of allowed values. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5a59e7e9ef3fdfc7dc7d4a80cbde6b524c5100b;p=openvswitch ovsdb: Annotate E-R diagram with number of allowed values. This makes the diagram even more informative. --- diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in index 5ba4e716..3c825d2a 100755 --- a/ovsdb/ovsdb-doc.in +++ b/ovsdb/ovsdb-doc.in @@ -293,7 +293,9 @@ The following diagram shows the relationship among tables in the database. Each node represents a table. Tables that are part of the ``root set'' are shown with double borders. Each edge leads from the table that contains it and points to the table that its value -represents. Edges are labeled with their column names. Thick lines +represents. Edges are labeled with their column names, followed by a +constraint on the number of allowed values: \\fB?\\fR for zero or one, +\\fB*\\fR for zero or more, \\fB+\\fR for one or more. Thick lines represent strong references; thin lines represent weak references. .RS -1in """ diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in index d4172862..30da1cb3 100755 --- a/ovsdb/ovsdb-dot.in +++ b/ovsdb/ovsdb-dot.in @@ -10,10 +10,25 @@ import sys argv0 = sys.argv[0] -def printEdge(tableName, baseType, label): +def printEdge(tableName, type, baseType, label): if baseType.ref_table: + if type.n_min == 0: + if type.n_max == 1: + arity = "?" + elif type.n_max == sys.maxint: + arity = "*" + else: + arity = "{,%d}" % type.n_max + elif type.n_min == 1: + if type.n_max == 1: + arity = "" + elif type.n_max == sys.maxint: + arity = "+" + else: + arity = "{1,%d}" % type.n_max + options = {} - options['label'] = '"%s"' % label + options['label'] = '"%s%s"' % (label, arity) if baseType.ref_type == 'weak': options['constraint'] = 'false' options['style'] = 'dotted' @@ -39,10 +54,10 @@ def schemaToDot(schemaFile): ', '.join(['%s=%s' % (k,v) for k,v in options.items()])) for columnName, column in table.columns.iteritems(): if column.type.value: - printEdge(tableName, column.type.key, "%s key" % columnName) - printEdge(tableName, column.type.value, "%s value" % columnName) + printEdge(tableName, column.type, column.type.key, "%s key" % columnName) + printEdge(tableName, column.type, column.type.value, "%s value" % columnName) else: - printEdge(tableName, column.type.key, columnName) + printEdge(tableName, column.type, column.type.key, columnName) print "}"; def usage(): diff --git a/vswitchd/vswitch.gv b/vswitchd/vswitch.gv index 35d1bacd..65916d47 100644 --- a/vswitchd/vswitch.gv +++ b/vswitchd/vswitch.gv @@ -4,31 +4,31 @@ digraph Open_vSwitch { node [shape=box]; edge [dir=none, arrowhead=none, arrowtail=none]; Bridge []; - Bridge -> sFlow [label="sflow"]; - Bridge -> Mirror [label="mirrors"]; - Bridge -> Port [label="ports"]; - Bridge -> Controller [label="controller"]; - Bridge -> NetFlow [label="netflow"]; + Bridge -> sFlow [label="sflow?"]; + Bridge -> Mirror [label="mirrors*"]; + Bridge -> Port [label="ports*"]; + Bridge -> Controller [label="controller*"]; + Bridge -> NetFlow [label="netflow?"]; QoS [style=bold]; - QoS -> Queue [label="queues value"]; + QoS -> Queue [label="queues value*"]; sFlow []; Open_vSwitch [style=bold]; - Open_vSwitch -> Bridge [label="bridges"]; - Open_vSwitch -> Capability [label="capabilities value"]; - Open_vSwitch -> SSL [label="ssl"]; - Open_vSwitch -> Manager [label="manager_options"]; + Open_vSwitch -> Bridge [label="bridges*"]; + Open_vSwitch -> Capability [label="capabilities value*"]; + Open_vSwitch -> SSL [label="ssl?"]; + Open_vSwitch -> Manager [label="manager_options*"]; Controller []; Queue [style=bold]; SSL []; Manager []; Capability []; Mirror []; - Mirror -> Port [style=dotted, constraint=false, label="select_src_port"]; - Mirror -> Port [style=dotted, constraint=false, label="output_port"]; - Mirror -> Port [style=dotted, constraint=false, label="select_dst_port"]; + Mirror -> Port [style=dotted, constraint=false, label="select_src_port*"]; + Mirror -> Port [style=dotted, constraint=false, label="output_port?"]; + Mirror -> Port [style=dotted, constraint=false, label="select_dst_port*"]; Interface []; NetFlow []; Port []; - Port -> QoS [label="qos"]; - Port -> Interface [label="interfaces"]; + Port -> QoS [label="qos?"]; + Port -> Interface [label="interfaces+"]; } diff --git a/vswitchd/vswitch.pic b/vswitchd/vswitch.pic index 161a811b..e17a696c 100644 --- a/vswitchd/vswitch.pic +++ b/vswitchd/vswitch.pic @@ -1,78 +1,78 @@ -.\" Generated from vswitch.gv with cksum "2042380787 1020" +.\" Generated from vswitch.gv with cksum "3079400319 1035" .PS linethick = 1; linethick = 1; -box at 2.735854117,2.79404 wid 0.5917916422 height 0.349255 "Bridge" +box at 2.691279811,2.68196 wid 0.5680525378 height 0.335245 "Bridge" linethick = 1; -box at 0.2716435539,1.9209025 wid 0.5432871078 height 0.349255 "sFlow" +box at 0.2607468561,1.8438475 wid 0.5214937122 height 0.335245 "sFlow" linethick = 1; -box at 0.999288406,1.9209025 wid 0.5723870344 height 0.349255 "Mirror" +box at 0.959202994,1.8438475 wid 0.5494263256 height 0.335245 "Mirror" linethick = 1; -box at 2.735854117,1.9209025 wid 0.5238825 height 0.349255 "Port" +box at 2.691279811,1.8438475 wid 0.5028675 height 0.335245 "Port" linethick = 1; -box at 3.589573039,1.9209025 wid 0.834300344 height 0.349255 "Controller" +box at 3.510752689,1.8438475 wid 0.800833256 height 0.335245 "Controller" linethick = 1; -box at 4.540315,1.9209025 wid 0.717928578 height 0.349255 "NetFlow" +box at 4.423356628,1.8438475 wid 0.689129622 height 0.335245 "NetFlow" linethick = 0.5; -box at 2.153715883,1.047765 wid 0.5238825 height 0.349255 "QoS" -box at 2.153715883,1.047765 wid 0.468326944444444 height 0.293699444444444 +box at 2.160452878,1.005735 wid 0.5028675 height 0.335245 "QoS" +box at 2.160452878,1.005735 wid 0.447311944444444 height 0.279689444444444 linethick = 0.5; -box at 2.153715883,0.1746275 wid 0.6014939461 height 0.349255 "Queue" -box at 2.153715883,0.1746275 wid 0.545938390544444 height 0.293699444444444 +box at 2.160452878,0.1676225 wid 0.5773656439 height 0.335245 "Queue" +box at 2.160452878,0.1676225 wid 0.521810088344444 height 0.279689444444444 linethick = 0.5; -box at 4.288083039,3.6671775 wid 1.125369461 height 0.349255 "Open_vSwitch" -box at 4.288083039,3.6671775 wid 1.06981390544444 height 0.293699444444444 +box at 4.218521933,3.5200725 wid 1.080226439 height 0.335245 "Open_vSwitch" +box at 4.218521933,3.5200725 wid 1.02467088344444 height 0.279689444444444 linethick = 1; -box at 3.608991617,2.79404 wid 0.824660906 height 0.349255 "Capability" +box at 3.529392311,2.68196 wid 0.791580494 height 0.335245 "Capability" linethick = 1; -box at 4.97688375,2.79404 wid 0.5238825 height 0.349255 "SSL" +box at 4.916904317,2.68196 wid 0.5028675 height 0.335245 "SSL" linethick = 1; -box at 5.782126078,2.79404 wid 0.746986594 height 0.349255 "Manager" +box at 5.689845189,2.68196 wid 0.717022006 height 0.335245 "Manager" linethick = 1; -box at 2.9686675,1.047765 wid 0.756695883 height 0.349255 "Interface" +box at 2.942713561,1.005735 wid 0.726341817 height 0.335245 "Interface" linethick = 1; -spline -> from 2.442619619,2.741512048 to 2.442619619,2.741512048 to 2.152179161,2.684932738 to 1.697309449,2.583858341 to 1.319415539,2.444785 to 1.046507682,2.344339262 to 0.751526909,2.19262289 to 0.5443278877,2.078276803 -"sflow" at 1.498862758,2.35747125 +spline -> from 2.411216138,2.64038962 to 2.411216138,2.64038962 to 2.110501373,2.590639262 to 1.621781212,2.494960339 to 1.219889506,2.346715 to 0.974758362,2.256265899 to 0.712999066,2.115798244 to 0.5250137847,2.006240178 +"sflow?" at 1.429417631,2.26290375 linethick = 1; -spline -> from 2.441222599,2.64595588 to 2.441222599,2.64595588 to 2.117044108,2.482923646 to 1.599797453,2.222868373 to 1.280857787,2.062490477 -"mirrors" at 2.2701575,2.35747125 +spline -> from 2.409137619,2.545448236 to 2.409137619,2.545448236 to 2.08321243,2.387748988 to 1.550776321,2.130079681 to 1.229812758,1.974794197 +"mirrors*" at 2.253583939,2.26290375 linethick = 1; -spline -> from 2.735854117,2.61731697 to 2.735854117,2.61731697 to 2.735854117,2.465880002 to 2.735854117,2.248713243 to 2.735854117,2.097346126 -"ports" at 2.910481617,2.35747125 +spline -> from 2.691279811,2.51232603 to 2.691279811,2.51232603 to 2.691279811,2.366963798 to 2.691279811,2.158508457 to 2.691279811,2.013213274 +"ports*" at 2.891488125,2.26290375 linethick = 1; -spline -> from 2.941216057,2.616897864 to 2.941216057,2.616897864 to 3.001357768,2.562972892 to 3.066389049,2.502621628 to 3.123876422,2.444785 to 3.233682194,2.334280718 to 3.350123811,2.203310093 to 3.439044134,2.100000464 -"controller" at 3.613811336,2.35747125 +spline -> from 2.937148494,2.511990785 to 2.937148494,2.511990785 to 3.002387171,2.46203928 to 3.0708442,2.40504763 to 3.128975683,2.346715 to 3.230286722,2.244934618 to 3.327910066,2.115664146 to 3.399049055,2.013682617 +"controller*" at 3.613203561,2.26290375 linethick = 1; -spline -> from 3.030625337,2.650077089 to 3.030625337,2.650077089 to 3.058565737,2.638831078 to 3.08671569,2.628423279 to 3.114167133,2.6194125 to 3.486333261,2.497732058 to 3.629388109,2.623743262 to 3.977595344,2.444785 to 4.142653257,2.359985886 to 4.294369629,2.212809829 to 4.398587321,2.096018957 -"netflow" at 4.482129117,2.35747125 +spline -> from 2.974025444,2.543101521 to 2.974025444,2.543101521 to 3.000845044,2.532507779 to 3.02793284,2.522651576 to 3.054484244,2.5143375 to 3.459527253,2.387078498 to 3.62668041,2.557986399 to 3.994980567,2.346715 to 4.133302654,2.267396033 to 4.247688248,2.125989692 to 4.323386569,2.013213274 +"netflow?" at 4.474582064,2.26290375 linethick = 0.5; -spline -> from 1.286026761,1.9209025 to 1.286026761,1.9209025 to 1.615513928,1.9209025 to 2.151690204,1.9209025 to 2.471468082,1.9209025 -"select_src_port" at 1.872425906,2.00821625 +spline -> from 1.237456344,1.8438475 to 1.237456344,1.8438475 to 1.569281845,1.8438475 to 2.119083645,1.8438475 to 2.439041473,1.8438475 +"select_src_port*" at 1.834527689,1.92765875 linethick = 0.5; -spline -> from 1.258645169,1.745436788 to 1.258645169,1.745436788 to 1.291056033,1.729929866 to 1.324654364,1.716658176 to 1.358182844,1.707437844 to 1.798942654,1.58631621 to 1.946607668,1.583661872 to 2.386599117,1.707437844 to 2.419429087,1.716728027 to 2.452189206,1.729999717 to 2.483831709,1.745436788 -"output_port" at 1.872425906,1.794751594 +spline -> from 1.215196076,1.675420412 to 1.215196076,1.675420412 to 1.2471114,1.660535534 to 1.280166557,1.647796224 to 1.313020567,1.638945756 to 1.76070674,1.518726899 to 1.909823716,1.513430028 to 2.356034811,1.638945756 to 2.387547841,1.647863273 to 2.419060871,1.660602583 to 2.449367019,1.675420412 +"output_port?" at 1.834527689,1.722757006 linethick = 0.5; -spline -> from 1.067043876,1.745157384 to 1.067043876,1.745157384 to 1.124391547,1.623197538 to 1.219738162,1.470014295 to 1.358182844,1.39702 to 1.762550283,1.183904599 to 1.983628698,1.181389963 to 2.386599117,1.39702 to 2.523437226,1.470293699 to 2.61591995,1.623407091 to 2.671172091,1.745366937 -"select_dst_port" at 1.872425906,1.48433375 +spline -> from 1.027123631,1.675018118 to 1.027123631,1.675018118 to 1.084316428,1.557883515 to 1.178520273,1.410845058 to 1.313020567,1.34098 to 1.724433231,1.127428935 to 1.947304107,1.122266162 to 2.356034811,1.34098 to 2.487383802,1.411314401 to 2.576156678,1.558285809 to 2.629192437,1.675353363 +"select_dst_port*" at 1.834527689,1.42479125 linethick = 1; -spline -> from 2.61801548,1.74417947 to 2.61801548,1.74417947 to 2.517010934,1.592742502 to 2.372279662,1.375575743 to 2.271344967,1.224208626 -"qos" at 2.6194125,1.48433375 +spline -> from 2.582124039,1.673408942 to 2.582124039,1.673408942 to 2.548331343,1.620641379 to 2.511119148,1.5622417 to 2.477058256,1.5086025 to 2.40638861,1.397100013 to 2.327203741,1.271383138 to 2.265719808,1.173558647 +"qos?" at 2.621414753,1.42479125 linethick = 1; -spline -> from 2.782933691,1.74417947 to 2.782933691,1.74417947 to 2.82337742,1.592742502 to 2.881214048,1.375575743 to 2.921587926,1.224208626 -"interfaces" at 3.211190172,1.48433375 +spline -> from 2.742170002,1.67421353 to 2.742170002,1.67421353 to 2.785751852,1.528851298 to 2.848308569,1.320395957 to 2.891890419,1.175100774 +"interfaces+" at 3.212786933,1.42479125 linethick = 1; -spline -> from 2.153715883,0.87104197 to 2.153715883,0.87104197 to 2.153715883,0.719605002 to 2.153715883,0.5024661834 to 2.153715883,0.3510571558 -"queues value" at 2.599993922,0.61119625 +spline -> from 2.160452878,0.83610103 to 2.160452878,0.83610103 to 2.160452878,0.690738798 to 2.160452878,0.4823102766 to 2.160452878,0.3369748642 +"queues value*" at 2.626108183,0.58667875 linethick = 1; -spline -> from 3.724595022,3.601727113 to 3.724595022,3.601727113 to 3.49604255,3.552831413 to 3.240737145,3.467333789 to 3.046271961,3.3179225 to 2.930598705,3.229072028 to 2.849431843,3.083781948 to 2.799139123,2.9686675 -"bridges" at 3.288794633,3.23060875 +spline -> from 3.676631915,3.429757497 to 3.676631915,3.429757497 to 3.372899945,3.369815691 to 3.032089878,3.28406002 to 2.914754128,3.1848275 to 2.814113579,3.09967527 to 2.75705488,2.96021335 to 2.725810046,2.849716598 +"bridges*" at 3.1848275,3.10101625 linethick = 1; -spline -> from 3.794446022,3.490733874 to 3.794446022,3.490733874 to 3.724734724,3.444981469 to 3.662148228,3.388122755 to 3.618700906,3.3179225 to 3.554996794,3.215031977 to 3.554857092,3.07763506 to 3.569455951,2.96936601 -"capabilities value" at 4.19106,3.23060875 +spline -> from 3.710961003,3.350840824 to 3.710961003,3.350840824 to 3.642839219,3.307124876 to 3.581690531,3.252614039 to 3.538712122,3.1848275 to 3.47649065,3.086801862 to 3.476356552,2.95484943 to 3.490637989,2.850789382 +"capabilities value*" at 4.125390872,3.10101625 linethick = 1; -spline -> from 4.579291858,3.492410298 to 4.579291858,3.492410298 to 4.646139265,3.442327131 to 4.712427864,3.383372887 to 4.763419094,3.3179225 to 4.843747744,3.214892275 to 4.898231524,3.077495358 to 4.932039408,2.969296159 -"ssl" at 4.957465172,3.23060875 +spline -> from 4.526209794,3.352114755 to 4.526209794,3.352114755 to 4.593862235,3.304711112 to 4.66057599,3.248457001 to 4.712069622,3.1848275 to 4.790919246,3.087405303 to 4.843150417,2.955452871 to 4.87513279,2.851191676 +"ssl?" at 4.930917558,3.10101625 linethick = 1; -spline -> from 4.738831542,3.490733874 to 4.738831542,3.490733874 to 4.853876139,3.439952197 to 4.97548673,3.381067804 to 5.083616078,3.3179225 to 5.25768477,3.216219444 to 5.439437072,3.078822527 to 5.573900247,2.970204222 -"manager_options" at 5.922805992,3.23060875 +spline -> from 4.735067429,3.351645412 to 4.735067429,3.351645412 to 4.853341865,3.304577014 to 4.976108584,3.24852405 to 5.084526817,3.1848275 to 5.243567045,3.091361194 to 5.403210714,2.956659753 to 5.518602043,2.850185941 +"manager_options*" at 5.908693125,3.10101625 .PE