[ovs-dev] [PATCH v5 3/6] ovn: Add type and options to logical port.

Russell Bryant rbryant at redhat.com
Fri Jul 31 17:14:42 UTC 2015


We have started discussing the use of the logical port abstraction in
OVN to represent special types of connections into an OVN logical
switch.  This patch proposes some schema updates to reflect these
special types of logical ports.  A logical port can have a "type" and
a set of options specific to that type.

Some examples of logical port types would be "vtep" for connectivity
to a VTEP gateway or "localnet" for a connection to a locally
accessible network via an ovs bridge.  Actualy support for these (or
other) types will come in later patches.

Signed-off-by: Russell Bryant <rbryant at redhat.com>
Acked-by: Ben Pfaff <blp at nicira.com>
---
 ovn/northd/ovn-northd.c | 11 +++++++++++
 ovn/ovn-nb.ovsschema    |  6 ++++++
 ovn/ovn-nb.xml          | 17 +++++++++++++++++
 ovn/ovn-sb.ovsschema    |  6 ++++++
 ovn/ovn-sb.xml          | 17 +++++++++++++++++
 5 files changed, 57 insertions(+)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 94e89ee..2a1913e 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -558,6 +558,12 @@ set_bindings(struct northd_context *ctx)
                     sbrec_binding_set_logical_datapath(binding,
                                                        *logical_datapath);
                 }
+                if (!strings_equal(binding->type, lport->type)) {
+                    sbrec_binding_set_type(binding, lport->type);
+                }
+                if (!smap_equal(&binding->options, &lport->options)) {
+                    sbrec_binding_set_options(binding, &lport->options);
+                }
             } else {
                 /* There is no binding for this logical port, so create one. */
 
@@ -578,6 +584,9 @@ set_bindings(struct northd_context *ctx)
                 sbrec_binding_set_tunnel_key(binding, tunnel_key);
                 sbrec_binding_set_logical_datapath(binding, *logical_datapath);
 
+                sbrec_binding_set_type(binding, lport->type);
+                sbrec_binding_set_options(binding, &lport->options);
+
                 /* Add the tunnel key to the tk_hmap so that we don't try to
                  * use it for another port.  (We don't want it in the lp_hmap
                  * because that would just get the Binding record deleted
@@ -806,6 +815,8 @@ main(int argc, char *argv[])
     ovsdb_idl_add_column(ovnsb_idl, &sbrec_binding_col_parent_port);
     ovsdb_idl_add_column(ovnsb_idl, &sbrec_binding_col_logical_datapath);
     ovsdb_idl_add_column(ovnsb_idl, &sbrec_binding_col_tunnel_key);
+    ovsdb_idl_add_column(ovnsb_idl, &sbrec_binding_col_type);
+    ovsdb_idl_add_column(ovnsb_idl, &sbrec_binding_col_options);
     ovsdb_idl_add_column(ovnsb_idl, &sbrec_pipeline_col_logical_datapath);
     ovsdb_idl_omit_alert(ovnsb_idl, &sbrec_pipeline_col_logical_datapath);
     ovsdb_idl_add_column(ovnsb_idl, &sbrec_pipeline_col_table_id);
diff --git a/ovn/ovn-nb.ovsschema b/ovn/ovn-nb.ovsschema
index 508b6cd..f17b649 100644
--- a/ovn/ovn-nb.ovsschema
+++ b/ovn/ovn-nb.ovsschema
@@ -25,6 +25,12 @@
         "Logical_Port": {
             "columns": {
                 "name": {"type": "string"},
+                "type": {"type": "string"},
+                "options": {
+                     "type": {"key": "string",
+                              "value": "string",
+                              "min": 0,
+                              "max": "unlimited"}},
                 "parent_name": {"type": {"key": "string", "min": 0, "max": 1}},
                 "tag": {
                      "type": {"key": {"type": "integer",
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 032e23d..fac6ad0 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -108,6 +108,23 @@
       </p>
     </column>
 
+    <column name="type">
+      <p>
+      Specify a type for this logical port.  Logical ports can be used to model
+      other types of connectivity into an OVN logical switch.  Leaving this column
+      blank maintains the default logical port behavior.
+      </p>
+
+      <p>
+      There are no other logical port types implemented yet.
+      </p>
+    </column>
+
+    <column name="options">
+        This column provides key/value settings specific to the logical port
+        <ref column="type"/>.
+    </column>
+
     <column name="parent_name">
       When <ref column="name"/> identifies the interface of a container
       spawned inside a tenant VM, this column represents the VM interface
diff --git a/ovn/ovn-sb.ovsschema b/ovn/ovn-sb.ovsschema
index f255006..e50e671 100644
--- a/ovn/ovn-sb.ovsschema
+++ b/ovn/ovn-sb.ovsschema
@@ -48,6 +48,12 @@
             "columns": {
                 "logical_datapath": {"type": "uuid"},
                 "logical_port": {"type": "string"},
+                "type": {"type": "string"},
+                "options": {
+                     "type": {"key": "string",
+                              "value": "string",
+                              "min": 0,
+                              "max": "unlimited"}},
                 "tunnel_key": {
                      "type": {"key": {"type": "integer",
                                       "minInteger": 1,
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 52fe969..468cbe8 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -673,6 +673,23 @@
       prescribe a particular format for the logical port ID.
     </column>
 
+    <column name="type">
+      <p>
+      A type for this logical port.  Logical ports can be used to model
+      other types of connectivity into an OVN logical switch.  Leaving this column
+      blank maintains the default logical port behavior.
+      </p>
+
+      <p>
+      There are no other logical port types implemented yet.
+      </p>
+    </column>
+
+    <column name="options">
+        This column provides key/value settings specific to the logical port
+        <ref column="type"/>.
+    </column>
+
     <column name="tunnel_key">
       <p>
         A number that represents the logical port in the key (e.g. VXLAN VNI or
-- 
2.4.3




More information about the dev mailing list