diff --git a/northd/northd.c b/northd/northd.c index 70d6932eb6..c9964c30e7 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -2381,6 +2381,15 @@ join_logical_ports(const struct sbrec_port_binding_table *sbrec_pb_table, continue; } + if (peer->nbrp->peer) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rl, "Bad configuration: The peer of the switch " + "port '%s' (LRP peer: '%s') has its own peer " + "configuration: '%s'", op->key, peer->key, + peer->nbrp->peer); + continue; + } + ovn_datapath_add_router_port(op->od, op); ovn_datapath_add_ls_peer(peer->od, op->od); peer->peer = op; diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index e61e06b55d..4e3fd3e706 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -14145,3 +14145,22 @@ check_row_count Port_Binding 1 logical_port=lrp2 options:peer{not-in}lrp0 AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([LSP using LRP with peer]) +ovn_start + +check ovn-nbctl --wait=sb sync \ + -- lr-add lr \ + -- ls-add ls \ + -- lrp-add lr lrp0 00:00:00:01:ff:01 192.168.1.1/24 peer=lrp1 \ + -- lrp-add lr lrp1 00:00:00:01:ff:01 192.168.1.1/24 peer=lrp0 \ + -- lsp-add ls ls-lrp1 \ + -- lsp-set-type ls-lrp1 router \ + -- lsp-set-options ls-lrp1 router-port=lrp1 \ + -- lsp-set-addresses ls-lrp1 router + +check grep -q "Bad configuration: The peer of the switch port 'ls-lrp1' (LRP peer: 'lrp1') has its own peer configuration: 'lrp0'" northd/ovn-northd.log + +AT_CLEANUP +])