[ovs-dev,RFC,ovn,08/10] ovn-sb: Add columns is_interconn and is_remote to Chassis.
diff mbox series

Message ID 1569623665-77390-9-git-send-email-hzhou8@ebay.com
State New
Headers show
Series
  • OVN Interconnection
Related show

Commit Message

Han Zhou Sept. 27, 2019, 10:34 p.m. UTC
From: Han Zhou <hzhou8@ebay.com>

Support the new columns in Chassis table for OVN interconnection.
Also, populate the is_interconn column according to external_ids:
is-interconn key of Open_vSwitch table on the chassis.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
---
 controller/chassis.c | 14 ++++++++++++++
 northd/ovn-northd.c  |  3 ++-
 ovn-sb.ovsschema     |  8 +++++---
 ovn-sb.xml           | 15 +++++++++++++++
 4 files changed, 36 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/controller/chassis.c b/controller/chassis.c
index 699b662..47ca75e 100644
--- a/controller/chassis.c
+++ b/controller/chassis.c
@@ -92,6 +92,8 @@  struct ovs_chassis_cfg {
     struct sset encap_ip_set;
     /* Interface type list formatted in the OVN-SB Chassis required format. */
     struct ds iface_types;
+    /* Is this chassis an interconnection gateway. */
+    bool is_interconn;
 };
 
 static void
@@ -172,6 +174,12 @@  get_datapath_type(const struct ovsrec_bridge *br_int)
     return "";
 }
 
+static bool
+get_is_interconn(const struct smap *ext_ids)
+{
+    return smap_get_bool(ext_ids, "is-interconn", false);
+}
+
 static void
 update_chassis_transport_zones(const struct sset *transport_zones,
                                const struct sbrec_chassis *chassis_rec)
@@ -285,6 +293,8 @@  chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table,
         sset_destroy(&ovs_cfg->encap_ip_set);
     }
 
+    ovs_cfg->is_interconn = get_is_interconn(&cfg->external_ids);
+
     return true;
 }
 
@@ -539,6 +549,10 @@  chassis_update(const struct sbrec_chassis *chassis_rec,
 
     update_chassis_transport_zones(transport_zones, chassis_rec);
 
+    if (ovs_cfg->is_interconn != chassis_rec->is_interconn) {
+        sbrec_chassis_set_is_interconn(chassis_rec, ovs_cfg->is_interconn);
+    }
+
     /* If any of the encaps should change, update them. */
     bool tunnels_changed =
         chassis_tunnels_changed(&ovs_cfg->encap_type_set,
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 32d70f8..d9c8a0f 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -9351,7 +9351,8 @@  check_and_add_supported_dhcpv6_opts_to_sb_db(struct northd_context *ctx)
 static const char *rbac_chassis_auth[] =
     {"name"};
 static const char *rbac_chassis_update[] =
-    {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches"};
+    {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches",
+        "is_interconn"};
 
 static const char *rbac_encap_auth[] =
     {"chassis_name"};
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
index 5c013b1..30b622d 100644
--- a/ovn-sb.ovsschema
+++ b/ovn-sb.ovsschema
@@ -1,7 +1,7 @@ 
 {
     "name": "OVN_Southbound",
-    "version": "2.5.0",
-    "cksum": "1257419092 20387",
+    "version": "2.6.0",
+    "cksum": "1645368988 20492",
     "tables": {
         "SB_Global": {
             "columns": {
@@ -40,7 +40,9 @@ 
                              "min": 0, "max": "unlimited"}},
                 "transport_zones" : {"type": {"key": "string",
                                               "min": 0,
-                                              "max": "unlimited"}}},
+                                              "max": "unlimited"}},
+                "is_interconn" : {"type": "boolean"},
+                "is_remote" : {"type": "boolean"}},
             "isRoot": true,
             "indexes": [["name"]]},
         "Encap": {
diff --git a/ovn-sb.xml b/ovn-sb.xml
index e5fb51a..9ba4274 100644
--- a/ovn-sb.xml
+++ b/ovn-sb.xml
@@ -301,6 +301,21 @@ 
       See <code>ovn-controller</code>(8) for more information.
     </column>
 
+    <column name="is_interconn">
+      <code>ovn-controller</code> populates this column with the setting
+      configured in the <ref table="Open_vSwitch"
+      column="external_ids:is-interconn"/> column of the Open_vSwitch
+      database's <ref table="Open_vSwitch" db="Open_vSwitch"/> table.
+      If set to true, the chassis is used as an interconnection gateway.
+      See <code>ovn-controller</code>(8) for more information.
+    </column>
+
+    <column name="is_remote">
+      <code>ovn-ic</code> set this column true for remote interconnection
+      gateway chassises learned from the interconnection southbound database.
+      See <code>ovn-ic</code>(8) for more information.
+    </column>
+
     <column name="external_ids" key="ovn-chassis-mac-mappings">
       <code>ovn-controller</code> populates this key with the set of options
       configured in the <ref table="Open_vSwitch"