I pushed this change to main and branch-22.03.
On 4/21/22 01:15, Ales Musil wrote:
Thanks, looks good to me.
Acked-by: Ales Musil <amu...@redhat.com>
On Thu, Apr 21, 2022 at 1:11 AM Ihar Hrachyshka <ihrac...@redhat.com> wrote:
When a binding switches to another chassis via requested-chassis
option, controller should stop sending periodic garps for the port.
Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com>
---
v1: initial commit
v2: don't add to sset instead of later deleting it explicitly from the
set
---
controller/pinctrl.c | 5 ++-
tests/ovn.at | 93 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 2 deletions(-)
diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 25b37ee88..f16f96ae5 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -5523,7 +5523,7 @@ get_localnet_vifs_l3gwports(
}
const struct sbrec_port_binding *pb
= lport_lookup_by_name(sbrec_port_binding_by_name,
iface_id);
- if (!pb) {
+ if (!pb || pb->chassis != chassis) {
continue;
}
struct local_datapath *ld
@@ -5781,7 +5781,8 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn
*ovnsb_idl_txn,
const struct sbrec_port_binding *pb = lport_lookup_by_name(
sbrec_port_binding_by_name, iface_id);
if (pb) {
- send_garp_rarp_update(ovnsb_idl_txn,
sbrec_mac_binding_by_lport_ip,
+ send_garp_rarp_update(ovnsb_idl_txn,
+ sbrec_mac_binding_by_lport_ip,
local_datapaths, pb, &nat_addresses);
}
}
diff --git a/tests/ovn.at b/tests/ovn.at
index f9551b843..afcf828f3 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -14113,6 +14113,99 @@ OVN_CLEANUP([hv1],[hv2])
AT_CLEANUP
])
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([garps disabled when port no longer bound to chassis])
+ovn_start
+
+net_add n1
+for i in 1 2; do
+ sim_add hv$i
+ as hv$i
+ check ovs-vsctl add-br br-phys
+ ovn_attach n1 br-phys 192.168.0.$i
+ check ovs-vsctl set open .
external-ids:ovn-bridge-mappings=phys:br-phys
+done
+
+check ovn-nbctl ls-add ls0
+check ovn-nbctl lsp-add ls0 port
+check ovn-nbctl lsp-set-addresses port "00:00:00:00:00:01 10.0.0.1"
+
+check ovn-nbctl lsp-add ls0 public
+check ovn-nbctl lsp-set-addresses public unknown
+check ovn-nbctl lsp-set-type public localnet
+check ovn-nbctl lsp-set-options public network_name=phys
+
+for hv in hv1 hv2; do
+ as $hv check ovs-vsctl -- add-port br-int port -- \
+ set Interface port external-ids:iface-id=port \
+ options:tx_pcap=$hv/port-tx.pcap \
+ options:rxq_pcap=$hv/port-rx.pcap
+done
+
+reset_pcap_file() {
+ local hv=$1
+ local iface=$2
+ local pcap_file=$3
+ as $hv check ovs-vsctl -- set Interface $iface
options:tx_pcap=dummy-tx.pcap \
+
options:rxq_pcap=dummy-rx.pcap
+ check rm -f ${pcap_file}*.pcap
+ as $hv check ovs-vsctl -- set Interface $iface
options:tx_pcap=${pcap_file}-tx.pcap \
+
options:rxq_pcap=${pcap_file}-rx.pcap
+}
+
+reset_env() {
+ reset_pcap_file hv1 br-phys_n1 hv1/br-phys_n1
+ reset_pcap_file hv2 br-phys_n1 hv2/br-phys_n1
+
+ for port in hv1/n1 hv2/n1; do
+ : > $port.expected
+ done
+}
+
+for hv in hv1 hv2; do
+ wait_row_count Chassis 1 name=$hv
+done
+hv1_uuid=$(fetch_column Chassis _uuid name=hv1)
+hv2_uuid=$(fetch_column Chassis _uuid name=hv2)
+
+OVN_POPULATE_ARP
+
+# Activate port on each hv giving a chance to each chassis to enable garps
+check ovn-nbctl lsp-set-options port requested-chassis=hv1
+wait_column "$hv1_uuid" Port_Binding chassis logical_port=port
+wait_column "$hv1_uuid" Port_Binding requested_chassis logical_port=port
+wait_for_ports_up
+reset_env
+
+# give chassis some time to generate garps
+sleep 2
+
+expected_garp=ffffffffffff000000000001080600010800060400010000000000010a0000010000000000000a000001
+
+# check hv1 sends garps and hv2 doesn't
+echo $expected_garp >> hv1/n1.expected
+OVN_CHECK_PACKETS_CONTAIN([hv1/br-phys_n1-tx.pcap], [hv1/n1.expected])
+OVN_CHECK_PACKETS([hv2/br-phys_n1-tx.pcap], [hv2/n1.expected])
+
+check ovn-nbctl lsp-set-options port requested-chassis=hv2
+wait_column "$hv2_uuid" Port_Binding chassis logical_port=port
+wait_column "$hv2_uuid" Port_Binding requested_chassis logical_port=port
+wait_for_ports_up
+reset_env
+
+# give chassis some time to generate garps
+sleep 2
+
+# check hv2 sends garps and hv1 doesn't
+echo $expected_garp >> hv2/n1.expected
+OVN_CHECK_PACKETS([hv1/br-phys_n1-tx.pcap], [hv1/n1.expected])
+OVN_CHECK_PACKETS_CONTAIN([hv2/br-phys_n1-tx.pcap], [hv2/n1.expected])
+
+OVN_CLEANUP([hv1],[hv2])
+
+AT_CLEANUP
+])
+
OVN_FOR_EACH_NORTHD([
AT_SETUP([IPv6 periodic RA disabled for localnet adjacent switch ports])
ovn_start
--
2.34.1
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev