@@ -113,7 +113,7 @@ tunnel_create_name(struct tunnel_ctx *tc, const char *chassis_id)
static void
tunnel_add(struct tunnel_ctx *tc, const char *new_chassis_id,
- const struct sbrec_encap *encap)
+ const struct sbrec_encap *encap, const char *encap_ip)
{
struct port_hash_node *hash_node;
@@ -167,6 +167,7 @@ tunnel_add(struct tunnel_ctx *tc, const char *new_chassis_id,
ovsrec_interface_set_name(iface, port_name);
ovsrec_interface_set_type(iface, encap->type);
smap_add(&options, "remote_ip", encap->ip);
+ smap_add(&options, "local_ip", encap_ip);
smap_add(&options, "key", "flow");
ovsrec_interface_set_options(iface, &options);
smap_destroy(&options);
@@ -235,6 +236,18 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
return;
}
+ const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ctx->ovs_idl);
+ if (!cfg) {
+ VLOG_INFO("No Open_vSwitch row defined.");
+ return;
+ }
+
+ const char *encap_ip = smap_get(&cfg->external_ids, "ovn-encap-ip");
+ if (!encap_ip) {
+ VLOG_INFO("Need to specify an encap ip");
+ return;
+ }
+
const struct sbrec_chassis *chassis_rec;
const struct ovsrec_bridge *br;
@@ -278,7 +291,7 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
VLOG_INFO("No supported encaps for '%s'", chassis_rec->name);
continue;
}
- tunnel_add(&tc, chassis_rec->name, encap);
+ tunnel_add(&tc, chassis_rec->name, encap, encap_ip);
}
}