summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2018-06-18 13:55:58 +0200
committerBen Pfaff <blp@ovn.org>2018-06-18 15:59:14 -0700
commit86558ac2e476a20c98491220c5a864af558bed28 (patch)
tree3feb65015be502804e98898e95758e8a8d7aa7a4 /tests
parent8ea0969bcdf66c7e030a636b647aeca9ad79002e (diff)
downloadopenvswitch-86558ac2e476a20c98491220c5a864af558bed28.tar.gz
OVN: add UDP port unreachable support to OVN logical router
Add priority-80 flows to generate ICMP port unreachable messages in reply to UDP datagrams directed to the router's IP address since the logical router doesn't accept any UDP traffic Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ovn.at76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/ovn.at b/tests/ovn.at
index b586afb4e..ee807f9c3 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -10344,3 +10344,79 @@ OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [vif1.expected])
OVN_CLEANUP([hv1], [hv2])
AT_CLEANUP
+
+AT_SETUP([ovn -- router port unreachable])
+AT_KEYWORDS([router-port-unreachable])
+AT_SKIP_IF([test $HAVE_PYTHON = no])
+ovn_start
+
+# test_ip_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_ROUTER L4_PROTCOL IP_CHKSUM EXP_IP_CHKSUM EXP_ICMP_CHKSUM EXP_ICMP_CODE
+#
+# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv4 packet with
+# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_ROUTER, L4_PROTCOL, IP_CHKSUM as specified.
+# EXP_IP_CHKSUM and EXP_ICMP_CHKSUM are the ip and icmp checksums of the icmp frame generated by OVN logical router
+# EXP_ICMP_CODE are code and type of the icmp frame generated by OVN logical router
+#
+# INPORT is a lport number, e.g. 11 for vif11.
+# HV is a hypervisor number
+# ETH_SRC and ETH_DST are each 12 hex digits.
+# IPV4_SRC and IPV4_ROUTER are each 8 hex digits.
+# IP_CHKSUM, EXP_IP_CHSUM and EXP_ICMP_CHKSUM are each 4 hex digits
+test_ip_packet() {
+ local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ip_router=$6 l4_proto=$7 ip_chksum=$8
+ local exp_ip_chksum=$9 exp_icmp_chksum=${10} exp_icmp_code=${11}
+ shift 11
+
+ local ip_ttl=ff
+ local packet=${eth_dst}${eth_src}08004500001400004000${ip_ttl}${l4_proto}${ip_chksum}${ipv4_src}${ip_router}
+
+ local reply_icmp_ttl=fe
+ local icmp_data=00000000
+ local reply_icmp_payload=${exp_icmp_code}${exp_icmp_chksum}${icmp_data}
+ local reply=${eth_src}${eth_dst}08004500001c00004000${reply_icmp_ttl}01${exp_ip_chksum}${ip_router}${ipv4_src}${reply_icmp_payload}
+ echo $reply >> vif$inport.expected
+
+ as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
+}
+
+ip_to_hex() {
+ printf "%02x%02x%02x%02x" "$@"
+}
+
+for i in 1 2; do
+ net_add n$i
+ ovn-nbctl ls-add sw$i
+
+ sim_add hv$i
+ as hv$i
+ ovs-vsctl add-br br-phys
+ ovn_attach n$i br-phys 192.168.$i.1
+
+ ovn-nbctl lsp-add sw$i sw$i-p${i}0 -- \
+ lsp-set-addresses sw$i-p${i}0 "00:00:00:00:00:0$i 192.168.$i.1"
+
+ ovs-vsctl -- add-port br-int vif$i -- \
+ set interface vif$i \
+ external-ids:iface-id=sw$i-p${i}0 \
+ options:tx_pcap=hv$i/vif$i-tx.pcap \
+ options:rxq_pcap=hv$i/vif$i-rx.pcap \
+ ofport-request=$i
+done
+
+ovn-nbctl lr-add lr0
+for i in 1 2; do
+ ovn-nbctl lrp-add lr0 lrp$i 00:00:00:00:ff:0$i 192.168.$i.254/24
+ ovn-nbctl -- lsp-add sw$i lrp$i-attachment \
+ -- set Logical_Switch_Port lrp$i-attachment type=router \
+ options:router-port=lrp$i addresses='"00:00:00:00:ff:'0$i'"'
+done
+
+OVN_POPULATE_ARP
+# allow some time for ovn-northd and ovn-controller to catch up.
+ovn-nbctl --wait=hv sync
+
+test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 1 254) 11 0000 7dae fcfc 0303
+OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [vif1.expected])
+
+OVN_CLEANUP([hv1], [hv2])
+AT_CLEANUP