tests: Update ovn localnet test case.
authorRussell Bryant <russell@ovn.org>
Thu, 14 Jan 2016 20:36:17 +0000 (15:36 -0500)
committerRussell Bryant <russell@ovn.org>
Fri, 15 Jan 2016 16:15:59 +0000 (11:15 -0500)
The OVN localnet port test case did not cover having 2 ports on the same
network and on the same hypervisor.  It also turns out that this case is
broken.  Update the test case to demonstrate the problem.  A solution
should be able to uncomment these additional test_packet lines and have
the test case still pass.

Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064413.html
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
tests/ovn.at

index a80f9a3..b990116 100644 (file)
@@ -737,8 +737,9 @@ for i in 1 2 3; do
 done
 AT_CLEANUP
 
-# 2 hypervisors, 2 logical ports per HV
-# 2 locally attached networks, 1 port per HV on each network
+# 2 hypervisors, 4 logical ports per HV
+# 2 locally attached networks (one flat, one vlan tagged over same device)
+# 2 ports per HV on each network
 AT_SETUP([ovn -- 2 HVs, 2 lports/HV, localnet ports])
 AT_KEYWORDS([ovn-localnet])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
@@ -756,7 +757,7 @@ for i in 1 2; do
     ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
     ovn_attach n1 br-phys 192.168.0.$i
 
-    for j in 1 2; do
+    for j in 1 2 3 4; do
         ovs-vsctl add-port br-int vif$i$j -- \
             set Interface vif$i$j external-ids:iface-id=lp$i$j \
                                   options:tx_pcap=hv$i/vif$i$j-tx.pcap \
@@ -769,7 +770,7 @@ for i in 1 2; do
 
         ovn-nbctl lswitch-add $lswitch_name
 
-        if test $j -eq 1; then
+        if test $j -le 2; then
             ovn-nbctl lport-add $lswitch_name $ln_port_name
         else
             ovn-nbctl lport-add $lswitch_name $ln_port_name "" 101
@@ -807,7 +808,7 @@ trim_zeros() {
     sed 's/\(00\)\{1,\}$//'
 }
 for i in 1 2; do
-    for j in 1 2; do
+    for j in 1 2 3 4; do
         : > $i$j.expected
     done
 done
@@ -822,23 +823,37 @@ test_packet() {
     done
 }
 
-# lp11 and lp21 are on the same network. (phys, untagged)
+# lp11 and lp21 are on the same network (phys, untagged)
+# and on different hypervisors
 test_packet 11 f00000000021 f00000000011 1121 21
 test_packet 21 f00000000011 f00000000021 2111 11
 
-# lp12 and lp22 are on the same network. (phys, VLAN 101)
-test_packet 12 f00000000022 f00000000012 1222 22
-test_packet 22 f00000000012 f00000000022 2212 12
+# lp11 and lp12 are on the same network (phys, untagged)
+# and on the same hypervisor
+# TODO this is broken.
+#test_packet 11 f00000000012 f00000000011 1112 12
+#test_packet 12 f00000000011 f00000000012 1211 11
+
+# lp13 and lp23 are on the same network (phys, VLAN 101)
+# and on different hypervisors
+test_packet 13 f00000000023 f00000000013 1323 23
+test_packet 23 f00000000013 f00000000023 2313 13
+
+# lp13 and lp14 are on the same network (phys, VLAN 101)
+# and on the same hypervisor
+# TODO this is broken.
+#test_packet 13 f00000000014 f00000000013 1314 14
+#test_packet 14 f00000000013 f00000000014 1413 13
 
 # Ports that should not be able to communicate
-test_packet 11 f00000000012 f00000000011 1112
-test_packet 11 f00000000022 f00000000011 1122
-test_packet 21 f00000000012 f00000000021 2112
-test_packet 21 f00000000022 f00000000021 2122
-test_packet 12 f00000000011 f00000000012 1211
-test_packet 12 f00000000021 f00000000012 1221
-test_packet 22 f00000000011 f00000000022 2211
-test_packet 22 f00000000021 f00000000022 2221
+test_packet 11 f00000000013 f00000000011 1113
+test_packet 11 f00000000023 f00000000011 1123
+test_packet 21 f00000000013 f00000000021 2113
+test_packet 21 f00000000023 f00000000021 2123
+test_packet 13 f00000000011 f00000000013 1311
+test_packet 13 f00000000021 f00000000013 1321
+test_packet 23 f00000000011 f00000000023 2311
+test_packet 23 f00000000021 f00000000023 2321
 
 # Allow some time for packet forwarding.
 # XXX This can be improved.
@@ -860,7 +875,7 @@ as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int
 
 # Now check the packets actually received against the ones expected.
 for i in 1 2; do
-    for j in 1 2; do
+    for j in 1 2 3 4; do
         file=hv$i/vif$i$j-tx.pcap
         echo $file
         $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i$j.packets