[ovs-dev] [PATCH] ovsdb: Annotate E-R diagram with number of allowed values.

Ethan Jackson ethan at nicira.com
Tue May 24 01:35:53 UTC 2011


I think this is fine.

I was going to complain that the diagram looks kinda funny in the man
page.  However, it looks funny in master too.  At some point we should
write a patch that fixes it.

Ethan

On Tue, May 3, 2011 at 12:27, Ben Pfaff <blp at nicira.com> wrote:
> This makes the diagram even more informative.
> ---
>  ovsdb/ovsdb-doc.in   |    4 +-
>  ovsdb/ovsdb-dot.in   |   25 ++++++++++--
>  vswitchd/vswitch.gv  |   34 ++++++++--------
>  vswitchd/vswitch.pic |  102 +++++++++++++++++++++++++-------------------------
>  4 files changed, 91 insertions(+), 74 deletions(-)
>
> diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in
> index 5ba4e71..3c825d2 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 d417286..30da1cb 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 b5c2b56..d80787e 100644
> --- a/vswitchd/vswitch.gv
> +++ b/vswitchd/vswitch.gv
> @@ -4,35 +4,35 @@ 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*"];
>        Monitor [];
> -       Monitor -> Maintenance_Point [label="remote_mps"];
> +       Monitor -> Maintenance_Point [label="remote_mps*"];
>        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 [];
> -       Interface -> Monitor [label="monitor"];
> +       Interface -> Monitor [label="monitor?"];
>        NetFlow [];
>        Maintenance_Point [];
>        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 f7264df..9f2d7ab 100644
> --- a/vswitchd/vswitch.pic
> +++ b/vswitchd/vswitch.pic
> @@ -1,88 +1,88 @@
> -.\" Generated from vswitch.gv with cksum "1443954516 1149"
> +.\" Generated from vswitch.gv with cksum "3872081095 1166"
>  .PS
>  linethick = 1;
>  linethick = 1;
> -box at 2.320997253,3.1110975 wid 0.5020540998 height 0.296295 "Bridge"
> +box at 2.378597001,3.1110975 wid 0.5020540998 height 0.296295 "Bridge"
>  linethick = 1;
>  box at 0.2304523251,2.37036 wid 0.4609046502 height 0.296295 "sFlow"
>  linethick = 1;
>  box at 0.847759254,2.37036 wid 0.4855919496 height 0.296295 "Mirror"
>  linethick = 1;
> -box at 2.320997253,2.37036 wid 0.4444425 height 0.296295 "Port"
> +box at 2.378597001,2.37036 wid 0.4444425 height 0.296295 "Port"
>  linethick = 1;
> -box at 3.045260751,2.37036 wid 0.707789496 height 0.296295 "Controller"
> +box at 3.102860499,2.37036 wid 0.707789496 height 0.296295 "Controller"
>  linethick = 1;
> -box at 3.851835,2.37036 wid 0.609064002 height 0.296295 "NetFlow"
> +box at 3.909434748,2.37036 wid 0.609064002 height 0.296295 "NetFlow"
>  linethick = 0.5;
> -box at 2.057590998,1.6296225 wid 0.4444425 height 0.296295 "QoS"
> -box at 2.057590998,1.6296225 wid 0.388886944444444 height 0.240739444444444
> +box at 2.098776003,1.6296225 wid 0.4444425 height 0.296295 "QoS"
> +box at 2.098776003,1.6296225 wid 0.388886944444444 height 0.240739444444444
>  linethick = 0.5;
> -box at 1.991754249,0.888885 wid 0.5102851749 height 0.296295 "Queue"
> -box at 1.991754249,0.888885 wid 0.454729619344444 height 0.240739444444444
> +box at 2.016465252,0.888885 wid 0.5102851749 height 0.296295 "Queue"
> +box at 2.016465252,0.888885 wid 0.454729619344444 height 0.240739444444444
>  linethick = 1;
> -box at 2.938238997,0.888885 wid 0.5761278498 height 0.296295 "Monitor"
> +box at 3.028786749,0.888885 wid 0.5761278498 height 0.296295 "Monitor"
>  linethick = 1;
> -box at 2.938238997,0.1481475 wid 1.218128004 height 0.296295 "Maintenance_Point"
> +box at 3.028786749,0.1481475 wid 1.218128004 height 0.296295 "Maintenance_Point"
>  linethick = 0.5;
> -box at 3.637850751,3.851835 wid 0.954721749 height 0.296295 "Open_vSwitch"
> -box at 3.637850751,3.851835 wid 0.899166193444444 height 0.240739444444444
> +box at 3.728398503,3.851835 wid 0.954721749 height 0.296295 "Open_vSwitch"
> +box at 3.728398503,3.851835 wid 0.899166193444444 height 0.240739444444444
>  linethick = 1;
> -box at 3.061734753,3.1110975 wid 0.699611754 height 0.296295 "Capability"
> +box at 3.119334501,3.1110975 wid 0.699611754 height 0.296295 "Capability"
>  linethick = 1;
> -box at 4.22220375,3.1110975 wid 0.4444425 height 0.296295 "SSL"
> +box at 4.345640247,3.1110975 wid 0.4444425 height 0.296295 "SSL"
>  linethick = 1;
> -box at 4.905341502,3.1110975 wid 0.633715746 height 0.296295 "Manager"
> +box at 5.028777999,3.1110975 wid 0.633715746 height 0.296295 "Manager"
>  linethick = 1;
> -box at 2.872402248,1.6296225 wid 0.641952747 height 0.296295 "Interface"
> +box at 2.946475998,1.6296225 wid 0.641952747 height 0.296295 "Interface"
>  linethick = 1;
> -spline -> from 2.072227971,3.066534732 to 2.072227971,3.066534732 to 1.825829049,3.018534942 to 1.439934441,2.932787169 to 1.119343251,2.8148025 to 0.887818338,2.729588058 to 0.637567581,2.60087751 to 0.4617876093,2.503870527
> -"sflow" at 1.271579622,2.74072875
> +spline -> from 2.131072158,3.07435692 to 2.131072158,3.07435692 to 1.865295543,3.030386742 to 1.433356692,2.945824149 to 1.078158246,2.8148025 to 0.861507342,2.734862109 to 0.630160206,2.610714504 to 0.4640157477,2.513885298
> +"sflow?" at 1.263342621,2.74072875
>  linethick = 1;
> -spline -> from 2.071042791,2.98546842 to 2.071042791,2.98546842 to 1.796021772,2.847157914 to 1.357208877,2.626536657 to 1.086632283,2.490477993
> -"mirrors" at 1.9259175,2.74072875
> +spline -> from 2.129235129,2.990446176 to 2.129235129,2.990446176 to 1.84117713,2.851069008 to 1.370601411,2.623336671 to 1.086928578,2.486092827
> +"mirrors*" at 1.991754249,2.74072875
>  linethick = 1;
> -spline -> from 2.320997253,2.96117223 to 2.320997253,2.96117223 to 2.320997253,2.832698718 to 2.320997253,2.648462487 to 2.320997253,2.520048234
> -"ports" at 2.469144753,2.74072875
> +spline -> from 2.378597001,2.96117223 to 2.378597001,2.96117223 to 2.378597001,2.832698718 to 2.378597001,2.648462487 to 2.378597001,2.520048234
> +"ports*" at 2.555544375,2.74072875
>  linethick = 1;
> -spline -> from 2.495218713,2.960816676 to 2.495218713,2.960816676 to 2.546240712,2.915068728 to 2.601410841,2.863868952 to 2.650180998,2.8148025 to 2.743336146,2.721054762 to 2.842120899,2.609944137 to 2.917557606,2.522300076
> -"controller" at 3.065823624,2.74072875
> +spline -> from 2.595899754,2.960875935 to 2.595899754,2.960875935 to 2.653558761,2.91672798 to 2.7140622,2.86635783 to 2.765439753,2.8148025 to 2.854980102,2.724847338 to 2.941261206,2.610595986 to 3.004135005,2.520463047
> +"controller*" at 3.193408251,2.74072875
>  linethick = 1;
> -spline -> from 2.571070233,2.988964701 to 2.571070233,2.988964701 to 2.594773833,2.979424002 to 2.61865521,2.970594411 to 2.641943997,2.96295 to 2.957675949,2.859720822 to 3.079038381,2.966624058 to 3.374444496,2.8148025 to 3.514473513,2.742862074 to 3.643184061,2.618003361 to 3.731598489,2.518922313
> -"netflow" at 3.802472253,2.74072875
> +spline -> from 2.628492204,2.988372111 to 2.628492204,2.988372111 to 2.652195804,2.979009189 to 2.67613644,2.970298116 to 2.699603004,2.96295 to 3.057586623,2.850476418 to 3.20531931,3.001527609 to 3.530828997,2.8148025 to 3.653080314,2.744699103 to 3.754176168,2.619721872 to 3.821079579,2.520048234
> +"netflow?" at 3.954708624,2.74072875
>  linethick = 0.5;
> -spline -> from 1.091017449,2.37036 to 1.091017449,2.37036 to 1.370542152,2.37036 to 1.825414236,2.37036 to 2.096701938,2.37036
> -"select_src_port" at 1.588496754,2.44443375
> +spline -> from 1.093684104,2.37036 to 1.093684104,2.37036 to 1.386956895,2.37036 to 1.872880695,2.37036 to 2.155664643,2.37036
> +"select_src_port*" at 1.621385499,2.44443375
>  linethick = 0.5;
> -spline -> from 1.067787921,2.221501392 to 1.067787921,2.221501392 to 1.095284097,2.208345894 to 1.123787676,2.197086684 to 1.152231996,2.189264496 to 1.526156286,2.08650939 to 1.651429812,2.084257548 to 2.024702253,2.189264496 to 2.052553983,2.197145943 to 2.080346454,2.208405153 to 2.107190781,2.221501392
> -"output_port" at 1.588496754,2.263338246
> +spline -> from 1.074010116,2.221501392 to 1.074010116,2.221501392 to 1.1022174,2.208345894 to 1.131432087,2.197086684 to 1.160468997,2.189264496 to 1.55614134,2.083013109 to 1.687933356,2.078331648 to 2.082302001,2.189264496 to 2.110153731,2.197145943 to 2.138005461,2.208405153 to 2.164790529,2.221501392
> +"output_port?" at 1.621385499,2.263338246
>  linethick = 0.5;
> -spline -> from 0.905240484,2.221264356 to 0.905240484,2.221264356 to 0.953892123,2.117798142 to 1.034780658,1.987843155 to 1.152231996,1.9259175 to 1.495282347,1.745118291 to 1.682837082,1.742984967 to 2.024702253,1.9259175 to 2.140790634,1.988080191 to 2.21924955,2.117975919 to 2.266123419,2.221442133
> -"select_dst_port" at 1.588496754,1.99999125
> +spline -> from 0.907788621,2.221145838 to 0.907788621,2.221145838 to 0.958336548,2.117620365 to 1.041595443,1.987665378 to 1.160468997,1.9259175 to 1.524082221,1.737177585 to 1.721059137,1.732614642 to 2.082302001,1.9259175 to 2.198390382,1.988080191 to 2.276849298,2.117975919 to 2.323723167,2.221442133
> +"select_dst_port*" at 1.621385499,1.99999125
>  linethick = 1;
> -spline -> from 2.267664153,2.22043473 to 2.267664153,2.22043473 to 2.221975464,2.091961218 to 2.156494269,1.907724987 to 2.11080558,1.779310734
> -"qos" at 2.312760252,1.99999125
> +spline -> from 2.321945397,2.22043473 to 2.321945397,2.22043473 to 2.273412276,2.091961218 to 2.20384221,1.907724987 to 2.155309089,1.779310734
> +"qos?" at 2.399159874,1.99999125
>  linethick = 1;
> -spline -> from 2.43258195,2.22043473 to 2.43258195,2.22043473 to 2.528225976,2.091961218 to 2.665351302,1.907724987 to 2.760995328,1.779310734
> -"interfaces" at 2.930001996,1.99999125
> +spline -> from 2.493500202,2.22043473 to 2.493500202,2.22043473 to 2.592047919,2.091961218 to 2.733262116,1.907724987 to 2.831750574,1.779310734
> +"interfaces+" at 3.045260751,1.99999125
>  linethick = 1;
> -spline -> from 2.023220778,1.479637971 to 2.023220778,1.479637971 to 2.013917115,1.433001138 to 2.005028265,1.381268031 to 1.99999125,1.3333275 to 1.989620925,1.235076078 to 1.98754686,1.123965453 to 1.988080191,1.037447313
> -"queues value" at 2.378597001,1.25925375
> +spline -> from 2.054391012,1.480171302 to 2.054391012,1.480171302 to 2.042479953,1.433534469 to 2.031102225,1.381682844 to 2.024702253,1.3333275 to 2.011724532,1.235372373 to 2.009650467,1.124261748 to 2.010835647,1.037684349
> +"queues value*" at 2.436196749,1.25925375
>  linethick = 1;
> -spline -> from 2.938238997,0.73895973 to 2.938238997,0.73895973 to 2.938238997,0.610486218 to 2.938238997,0.4262736906 to 2.938238997,0.2978238822
> -"remote_mps" at 3.288044874,0.51851625
> +spline -> from 3.028786749,0.73895973 to 3.028786749,0.73895973 to 3.028786749,0.610486218 to 3.028786749,0.4262736906 to 3.028786749,0.2978238822
> +"remote_mps*" at 3.411481371,0.51851625
>  linethick = 1;
> -spline -> from 3.159808398,3.796309317 to 3.159808398,3.796309317 to 2.96591295,3.754828017 to 2.749321305,3.682295001 to 2.584344249,3.55554 to 2.486211345,3.480162552 to 2.417352387,3.356903832 to 2.374685907,3.259245
> -"bridges" at 2.790091497,3.48146625
> +spline -> from 3.249467265,3.772013127 to 3.249467265,3.772013127 to 2.981023995,3.719035581 to 2.679810498,3.64324332 to 2.576107248,3.55554 to 2.487159489,3.48028107 to 2.43673008,3.35702235 to 2.409115386,3.259363518
> +"bridges*" at 2.8148025,3.48146625
>  linethick = 1;
> -spline -> from 3.219067398,3.702146766 to 3.219067398,3.702146766 to 3.159926916,3.663332121 to 3.106830852,3.615095295 to 3.069971754,3.55554 to 3.015927546,3.468251493 to 3.015809028,3.35168904 to 3.028194159,3.25983759
> -"capabilities value" at 3.55554,3.48146625
> +spline -> from 3.279807873,3.702265284 to 3.279807873,3.702265284 to 3.219600729,3.663628416 to 3.165556521,3.615450849 to 3.127571502,3.55554 to 3.07257915,3.468903342 to 3.072460632,3.35228163 to 3.085082799,3.260311662
> +"capabilities value*" at 3.646087752,3.48146625
>  linethick = 1;
> -spline -> from 3.884901522,3.703568982 to 3.884901522,3.703568982 to 3.941612385,3.661080279 to 3.997849176,3.611065683 to 4.041108246,3.55554 to 4.109256096,3.468132975 to 4.155478116,3.351570522 to 4.184159472,3.259778331
> -"ssl" at 4.205729748,3.48146625
> +spline -> from 4.000338054,3.703391205 to 4.000338054,3.703391205 to 4.060130385,3.661495092 to 4.11909309,3.611776791 to 4.164604002,3.55554 to 4.234292586,3.469436673 to 4.280455347,3.352814961 to 4.30872189,3.260667216
> +"ssl?" at 4.358025378,3.48146625
>  linethick = 1;
> -spline -> from 4.020249078,3.702146766 to 4.020249078,3.702146766 to 4.117848651,3.659065473 to 4.22101857,3.609110136 to 4.312751502,3.55554 to 4.46042493,3.469258896 to 4.614616848,3.352696443 to 4.728690423,3.260548698
> -"manager_options" at 5.024689128,3.48146625
> +spline -> from 4.184929839,3.702976392 to 4.184929839,3.702976392 to 4.289462715,3.661376574 to 4.397965944,3.61183605 to 4.493787747,3.55554 to 4.634350095,3.472932954 to 4.775445774,3.353881623 to 4.877430513,3.259778331
> +"manager_options*" at 5.222199375,3.48146625
>  linethick = 1;
> -spline -> from 2.885735523,1.47969723 to 2.885735523,1.47969723 to 2.89717251,1.351223718 to 2.913527994,1.166987487 to 2.924964981,1.038573234
> -"monitor" at 3.139897374,1.25925375
> +spline -> from 2.963127777,1.47969723 to 2.963127777,1.47969723 to 2.977409196,1.351223718 to 2.99791281,1.166987487 to 3.01213497,1.038573234
> +"monitor?" at 3.251007999,1.25925375
>  .PE
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list