[ovs-dev] [PATCH 15/23] ovn-nb: Extend schema to support networks of routers.

Ben Pfaff blp at nicira.com
Sat Oct 10 04:20:34 UTC 2015


Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ovn/TODO             |  6 ------
 ovn/ovn-nb.ovsschema | 10 +++++++---
 ovn/ovn-nb.xml       | 49 ++++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/ovn/TODO b/ovn/TODO
index c914c10..c8a0338 100644
--- a/ovn/TODO
+++ b/ovn/TODO
@@ -4,12 +4,6 @@
 
 ** OVN_Northbound schema
 
-*** Needs to support interconnected routers
-
-It should be possible to connect one router to another, e.g. to
-represent a provider/tenant router relationship.  This requires
-an OVN_Northbound schema change.
-
 *** Needs to support extra routes
 
 Currently a router port has a single route associated with it, but
diff --git a/ovn/ovn-nb.ovsschema b/ovn/ovn-nb.ovsschema
index 780fe33..985a0cd 100644
--- a/ovn/ovn-nb.ovsschema
+++ b/ovn/ovn-nb.ovsschema
@@ -1,7 +1,7 @@
 {
     "name": "OVN_Northbound",
     "version": "1.0.0",
-    "cksum": "3052542625 4535",
+    "cksum": "3156743511 4790",
     "tables": {
         "Logical_Switch": {
             "columns": {
@@ -18,7 +18,7 @@
                                   "max": "unlimited"}},
                 "router_port": {"type": {"key": {"type": "uuid",
                                                  "refTable": "Logical_Router_Port",
-                                                 "refType": "strong"},
+                                                 "refType": "weak"},
                                          "min": 0, "max": 1}},
                 "external_ids": {
                     "type": {"key": "string", "value": "string",
@@ -72,7 +72,7 @@
                 "name": {"type": "string"},
                 "ports": {"type": {"key": {"type": "uuid",
                                            "refTable": "Logical_Router_Port",
-                                           "refType": "weak"},
+                                           "refType": "strong"},
                                    "min": 0,
                                    "max": "unlimited"}},
                 "default_gw": {"type": {"key": "string", "min": 0, "max": 1}},
@@ -85,6 +85,10 @@
                 "name": {"type": "string"},
                 "network": {"type": "string"},
                 "mac": {"type": "string"},
+                "peer": {"type": {"key": {"type": "uuid",
+                                          "refTable": "Logical_Router_Port",
+                                          "refType": "strong"},
+                                  "min": 0, "max": 1}},
                 "external_ids": {
                     "type": {"key": "string", "value": "string",
                              "min": 0, "max": "unlimited"}}},
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 54dcacf..0b93709 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -373,9 +373,7 @@
     </column>
 
     <column name="ports">
-      The router's ports.  This is a set of weak references, so a <ref
-      table="Logical_Switch"/> must also refer to any given <ref
-      table="Logical_Router_Port"/> or it will automatically be deleted.
+      The router's ports.
     </column>
 
     <column name="default_gw">
@@ -395,14 +393,8 @@
     </p>
 
     <p>
-      A router port is always attached to a logical switch and to a logical
-      router.  The former attachment, which is enforced by the database schema,
-      can be identified by finding the <ref table="Logical_Switch"/> row whose
-      <ref column="router_port" table="Logical_Switch"/> column points to the
-      router port.  The latter attachment, which the database schema does not
-      enforce, can be identified by finding the <ref table="Logical_Router"/>
-      row whose <ref column="ports" table="Logical_Router"/> column includes
-      the router port.
+      Exactly one <ref table="Logical_Router"/> row must reference a given
+      logical router port.
     </p>
 
     <column name="name">
@@ -425,6 +417,41 @@
       The Ethernet address that belongs to this router port.
     </column>
 
+    <group title="Attachment">
+      <p>
+        A given router port serves one of two purposes:
+      </p>
+
+      <ul>
+        <li>
+          To attach a logical switch to a logical router.  A logical router
+          port of this type is referenced by exactly the <ref
+          column="router_port" table="Logical_Switch"/> column in exactly one
+          <ref table="Logical_Switch"/> row.  The <ref column="peer"/> column
+          is empty.
+        </li>
+
+        <li>
+          To connect one logical router to another.  This requires a pair of
+          logical router ports, each connected to a different router.  Each
+          router port in the pair specifies the other in its <ref
+          column="peer"/> column.  No <ref table="Logical_Switch"/> refers to
+          the router port.
+        </li>
+      </ul>
+
+      <column name="peer">
+        <p>
+          For a router port used to connect two logical routers, this
+          identifies the other router port in the pair.
+        </p>
+
+        <p>
+          For a router port attached to a logical switch, this column is empty.
+        </p>
+      </column>
+    </group>
+
     <group title="Common Columns">
       <column name="external_ids">
         See <em>External IDs</em> at the beginning of this document.
-- 
2.1.3




More information about the dev mailing list