@@ -1096,11 +1096,22 @@ route_need_advertise(const char *policy,
static void
add_to_routes_ad(struct hmap *routes_ad, struct ic_route_info *ic_route)
{
+ const char *route_table = ic_route->route_table ? ic_route->route_table
+ : "";
uint hash = ic_route_hash(&ic_route->prefix, ic_route->plen,
&ic_route->nexthop, ic_route->origin,
- ic_route->route_table ? ic_route->route_table
- : "");
- hmap_insert(routes_ad, &ic_route->node, hash);
+ route_table);
+
+ if (!ic_route_find(routes_ad, &ic_route->prefix, ic_route->plen,
+ &ic_route->nexthop, ic_route->origin, route_table,
+ hash)) {
+ hmap_insert(routes_ad, &ic_route->node, hash);
+ }
+ else {
+ VLOG_WARN("Duplicate route advertisement was suppressed! NB route "
+ "uuid: "UUID_FMT,
+ UUID_ARGS(&ic_route->nb_route->header_.uuid));
+ }
}
static void
@@ -1,7 +1,7 @@
{
"name": "OVN_IC_Southbound",
- "version": "1.1.0",
- "cksum": "2309827842 6784",
+ "version": "1.1.1",
+ "cksum": "3684563024 6914",
"tables": {
"IC_SB_Global": {
"columns": {
@@ -101,6 +101,8 @@
"external_ids": {
"type": {"key": "string", "value": "string",
"min": 0, "max": "unlimited"}}},
+ "indexes": [["transit_switch", "availability_zone", "route_table",
+ "ip_prefix", "nexthop"]],
"isRoot": true},
"Connection": {
"columns": {
@@ -194,6 +194,66 @@ OVN_CLEANUP_IC
AT_CLEANUP
])
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([ovn-ic -- duplicate NB route adv/learn])
+
+ovn_init_ic_db
+net_add n1
+
+# 1 GW per AZ
+for i in 1 2; do
+ az=az$i
+ ovn_start $az
+ sim_add gw-$az
+ as gw-$az
+ check ovs-vsctl add-br br-phys
+ ovn_az_attach $az n1 br-phys 192.168.1.$i
+ check ovs-vsctl set open . external-ids:ovn-is-interconn=true
+ check ovn-nbctl set nb-global . \
+ options:ic-route-adv=true \
+ options:ic-route-adv-default=true \
+ options:ic-route-learn=true \
+ options:ic-route-learn-default=true
+done
+
+ovn_as az1
+
+# create transit switch and connect to LR
+check ovn-ic-nbctl ts-add ts1
+for i in 1 2; do
+ ovn_as az$i
+
+ check ovn-nbctl lr-add lr1
+ check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24
+ check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i
+
+ check ovn-nbctl lsp-add ts1 lsp$i -- \
+ lsp-set-addresses lsp$i router -- \
+ lsp-set-type lsp$i router -- \
+ lsp-set-options lsp$i router-port=lrp$i
+done
+
+ovn_as az1
+
+ovn-nbctl \
+ --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \
+ add logical-router lr1 static_routes @id
+ovn-nbctl \
+ --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \
+ add logical-router lr1 static_routes @id
+
+wait_row_count ic-sb:route 1 ip_prefix=1.1.1.1/32
+
+for i in 1 2; do
+ az=az$i
+ OVN_CLEANUP_SBOX(gw-$az)
+ OVN_CLEANUP_AZ([$az])
+done
+
+OVN_CLEANUP_IC
+AT_CLEANUP
+])
+
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- gateway sync])
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com> --- ic/ovn-ic.c | 17 ++++++++++--- ovn-ic-sb.ovsschema | 6 +++-- tests/ovn-ic.at | 60 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 5 deletions(-)