[ovs-dev] [PATCH 2/4] tests: Remove trim_zeros() from ovn tests.

Daniele Di Proietto diproiettod at vmware.com
Fri Jul 29 02:58:04 UTC 2016


trim_zeros() is not necessary anymore, since now we don't pad packets in
the userspace datapath.

Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
 tests/ovn.at | 135 +++++++++++++++++++----------------------------------------
 1 file changed, 43 insertions(+), 92 deletions(-)

diff --git a/tests/ovn.at b/tests/ovn.at
index dfdd110..5761981 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -737,9 +737,6 @@ vif_to_hv() {
 # digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
 # more) list the VIFs on which the packet should be received.  INPORT and the
 # OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2 3; do
     for j in 1 2 3; do
         : > $i$j.expected
@@ -751,7 +748,7 @@ test_packet() {
     vif=vif$inport
     as $hv ovs-appctl netdev-dummy/receive $vif $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -935,7 +932,7 @@ for i in 1 2 3; do
     for j in 1 2 3; do
         file=hv$i/vif$i$j-tx.pcap
         echo $file
-        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i$j.packets
+        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i$j.packets
         sort $i$j.expected > expout
         AT_CHECK([sort $i$j.packets], [0], [expout])
         echo
@@ -1038,9 +1035,6 @@ vif_to_hv() {
 # digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
 # more) list the VIFs on which the packet should be received.  INPORT and the
 # OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2; do
     for j in 1 2 3 4 5; do
         : > $i$j.expected
@@ -1053,7 +1047,7 @@ test_packet() {
     vif=vif$inport
     as $hv ovs-appctl netdev-dummy/receive $vif $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -1120,7 +1114,7 @@ for i in 1 2; do
     for j in 1 2 3 4 5; do
         file=hv$i/vif$i$j-tx.pcap
         echo $file
-        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i$j.packets
+        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i$j.packets
         sort $i$j.expected > expout
         AT_CHECK([sort $i$j.packets], [0], [expout])
         echo
@@ -1223,9 +1217,6 @@ sleep 1
 # digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
 # more) list the VIFs on which the packet should be received.  INPORT and the
 # OUTPORTs are specified as logical switch port numbers, e.g. 1 for vif1.
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2 3; do
     : > $i.expected
 done
@@ -1236,7 +1227,7 @@ test_packet() {
     vif=vif$inport
     as $hv ovs-appctl netdev-dummy/receive $vif $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -1302,7 +1293,7 @@ AT_CHECK([as hv3 ovs-ofctl -O OpenFlow13 show br-int], [1], [],
 for i in 1 2 3; do
     file=hv$i/vif$i-tx.pcap
     echo $file
-    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i.packets
+    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i.packets
     sort $i.expected > expout
     AT_CHECK([sort $i.packets], [0], [expout])
     echo
@@ -1384,9 +1375,6 @@ sleep 1
 # digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
 # more) list the VIFs on which the packet should be received.  INPORT and the
 # OUTPORTs are specified as lport numbers, e.g. 1 for vif1.
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2 3; do
     : > $i.expected
 done
@@ -1397,7 +1385,7 @@ test_packet() {
     vif=vif$inport
     as $hv ovs-appctl netdev-dummy/receive $vif $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -1468,7 +1456,7 @@ as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-phys
 for i in 1 2 3; do
     file=hv$i/vif$i-tx.pcap
     echo $file
-    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i.packets
+    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i.packets
     sort $i.expected > expout
     AT_CHECK([sort $i.packets], [0], [expout])
     echo
@@ -1593,9 +1581,6 @@ sleep 1
 # digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
 # more) list the VIFs on which the packet should be received.  INPORT and the
 # OUTPORTs are specified as logical switch port numbers, e.g. 123 for vif123.
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2 3; do
     for j in 1 2 3; do
         for k in 1 2 3; do
@@ -1623,7 +1608,7 @@ test_ip() {
             # (and checksum).
             out_lrp=`vif_to_lrp $outport`
             echo f00000000${outport}00000000ff${out_lrp}08004500001c00000000"3f1101"00${src_ip}${dst_ip}0035111100080000
-        fi | trim_zeros >> $outport.expected
+        fi >> $outport.expected
     done
 }
 
@@ -1702,7 +1687,7 @@ for is in 1 2 3; do
           arp=ffffffffffff${lrmac}08060001080006040001${lrmac}${lrip}000000000000${dip}
           for jd2 in 1 2 3; do
             for kd in 1 2 3; do
-              echo $arp | trim_zeros >> $id$jd2$kd.expected
+              echo $arp >> $id$jd2$kd.expected
             done
           done
         done
@@ -1862,7 +1847,7 @@ for is in 1 2 3; do
           host_mac=8000000000$o4
           outport=${id}11
           out_lrp=$id$jd
-          echo ${host_mac}00000000ff${out_lrp}08004500001c00000000"3f1101"00${sip}${dip}0035111100080000 | trim_zeros >> $outport.expected
+          echo ${host_mac}00000000ff${out_lrp}08004500001c00000000"3f1101"00${sip}${dip}0035111100080000 >> $outport.expected
         done
       done
     done
@@ -1882,7 +1867,7 @@ for i in 1 2 3; do
         for k in 1 2 3; do
             file=hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap
             echo $file
-            $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i$j$k.packets
+            $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i$j$k.packets
             sort $i$j$k.expected > expout
             AT_CHECK([sort $i$j$k.packets], [0], [expout])
             echo
@@ -1952,9 +1937,6 @@ vif_to_hv() {
 }
 
 
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2 3; do
     for j in 1 2 3; do
         : > $i$j.expected
@@ -1978,7 +1960,7 @@ test_ip() {
     as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
     #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -2029,7 +2011,7 @@ test_ipv6() {
     as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
     #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -2044,7 +2026,7 @@ test_icmpv6() {
     as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
     #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
     for outport; do
-        echo $packet | trim_zeros >> $outport.expected
+        echo $packet >> $outport.expected
     done
 }
 
@@ -2281,7 +2263,7 @@ for i in 1 2 3; do
     for j in 1 2 3; do
         file=hv$i/vif$i$j-tx.pcap
         echo $file
-        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i$j.packets
+        $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i$j.packets
         sort $i$j.expected > expout
         AT_CHECK([sort $i$j.packets], [0], [expout])
         echo
@@ -2372,9 +2354,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Packet to send.
 src_mac="f00000010203"
@@ -2411,8 +2390,8 @@ src_mac="000000010204"
 dst_mac="f00000010204"
 expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | trim_zeros > received.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap > received.packets
+echo $expected > expout
 AT_CHECK([cat received.packets], [0], [expout])
 
 OVN_CLEANUP([hv1],[hv2])
@@ -2474,9 +2453,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Packet to send.
 src_mac="f00000010203"
@@ -2524,8 +2500,8 @@ expect_src_mac="000000010203"
 expect_dst_mac="f00000010204"
 expected=${expect_dst_mac}${expect_src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap | trim_zeros > received.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > received.packets
+echo $expected > expout
 AT_CHECK([cat received.packets], [0], [expout])
 
 
@@ -2610,9 +2586,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Packet to send.
 src_mac="f00000010203"
@@ -2663,8 +2636,8 @@ expect_src_mac="000000010204"
 expect_dst_mac="f00000010204"
 expected=${expect_dst_mac}${expect_src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap | trim_zeros > received.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > received.packets
+echo $expected > expout
 AT_CHECK([cat received.packets], [0], [expout])
 
 
@@ -2768,9 +2741,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Send ip packets between foo1 and alice1
 src_mac="f00000010203"
@@ -2814,8 +2784,8 @@ src_ip=`ip_to_hex 192 168 1 2`
 dst_ip=`ip_to_hex 172 16 2 2`
 expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | trim_zeros > received.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap > received.packets
+echo $expected > expout
 AT_CHECK([cat received.packets], [0], [expout])
 
 # Packet to Expect at alice1
@@ -2825,8 +2795,8 @@ src_ip=`ip_to_hex 192 168 1 2`
 dst_ip=`ip_to_hex 172 16 1 2`
 expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap | trim_zeros > received1.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > received1.packets
+echo $expected > expout
 AT_CHECK([cat received1.packets], [0], [expout])
 
 OVN_CLEANUP([hv1],[hv2])
@@ -2865,10 +2835,7 @@ AT_CHECK([ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 externa
 
 # Wait for packet to be received.
 OVS_WAIT_UNTIL([test `wc -c < "hv/snoopvif-tx.pcap"` -ge 50])
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv/snoopvif-tx.pcap | trim_zeros > packets
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv/snoopvif-tx.pcap > packets
 expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80102000000000000c0a80102"
 echo $expected > expout
 AT_CHECK([sort packets], [0], [expout])
@@ -2996,9 +2963,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Send ip packets between foo1 and alice1
 src_mac="f00000010203"
@@ -3048,8 +3012,8 @@ src_ip=`ip_to_hex 192 168 1 2`
 dst_ip=`ip_to_hex 10 32 1 2`
 expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | trim_zeros > received.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap > received.packets
+echo $expected > expout
 AT_CHECK([cat received.packets], [0], [expout])
 
 # Packet to Expect at alice1
@@ -3059,8 +3023,8 @@ src_ip=`ip_to_hex 192 168 1 2`
 dst_ip=`ip_to_hex 172 16 1 2`
 expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap | trim_zeros > received1.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > received1.packets
+echo $expected > expout
 AT_CHECK([cat received1.packets], [0], [expout])
 
 OVN_CLEANUP([hv1],[hv2])
@@ -3138,10 +3102,6 @@ sleep 2
 
 as hv1 ovs-vsctl show
 
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
-
 # This shell function sends a DHCP request packet
 # test_dhcp INPORT SRC_MAC DHCP_TYPE OFFER_IP ...
 test_dhcp() {
@@ -3204,7 +3164,7 @@ test_dhcp() {
     else
         shift; shift; shift; shift;
         for outport; do
-            echo $request | trim_zeros >> $outport.expected
+            echo $request >> $outport.expected
         done
     fi
     as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request
@@ -3299,7 +3259,7 @@ test_dhcp 2 f00000000002 08 $offer_ip 1 1
 OVS_WAIT_UNTIL([test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
 
 # vif1-tx.pcap should have received the DHCPv4 (invalid) request packet
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | trim_zeros > 1.packets
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
 cat 1.expected > expout
 AT_CHECK([cat 1.packets], [0], [expout])
 
@@ -3320,11 +3280,11 @@ test_dhcp 4 f00000000004 01 0 3
 # NXT_RESUMEs should be 3.
 OVS_WAIT_UNTIL([test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap | trim_zeros > 3.packets
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap > 3.packets
 cat 3.expected > expout
 AT_CHECK([cat 3.packets], [0], [expout])
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif4-tx.pcap | trim_zeros > 4.packets
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif4-tx.pcap > 4.packets
 cat 4.expected > expout
 AT_CHECK([cat 4.packets], [0], [expout])
 
@@ -3443,9 +3403,6 @@ sleep 2
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 
 # Send ip packets between foo1 and alice1
 src_mac="f00000010203"
@@ -3492,8 +3449,8 @@ as hv2 ovs-ofctl show br-int
 as hv2 ovs-ofctl dump-flows br-int
 echo "----------------------------"
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | trim_zeros > received1.packets
-echo $expected | trim_zeros > expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap > received1.packets
+echo $expected > expout
 AT_CHECK([cat received1.packets], [0], [expout])
 
 # Delete the router and re-create it. Things should work as before.
@@ -3522,8 +3479,8 @@ as hv2 ovs-ofctl show br-int
 as hv2 ovs-ofctl dump-flows br-int
 echo "----------------------------"
 
-$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | trim_zeros > received1.packets
-echo $expected | trim_zeros >> expout
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap > received1.packets
+echo $expected >> expout
 AT_CHECK([cat received1.packets], [0], [expout])
 
 OVN_CLEANUP([hv1],[hv2])
@@ -3590,9 +3547,6 @@ sleep 1
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2; do
     : > vif$i.expected
 done
@@ -3674,8 +3628,8 @@ as hv1 ovs-ofctl dump-flows br-int
 for inport in 1 2; do
     file=hv1/vif${inport}-tx.pcap
     echo $file
-    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > received.packets
-    cat vif$inport.expected | trim_zeros > expout
+    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > received.packets
+    cat vif$inport.expected > expout
     AT_CHECK([cat received.packets], [0], [expout])
 done
 
@@ -3756,9 +3710,6 @@ sleep 1
 vif_to_hv() {
     echo hv1${1%?}
 }
-trim_zeros() {
-    sed 's/\(00\)\{1,\}$//'
-}
 for i in 1 2; do
     : > $i.expected
 done
@@ -3770,7 +3721,7 @@ ns_packet=3333ffa1f9aefa163e94059886dd6000000000203afffd81ce49a9480000f8163efffe
 na_packet=fa163e940598fa163ea1f9ae86dd6000000000203afffd81ce49a9480000f8163efffea1f9aefd81ce49a9480000f8163efffe9405988800e9ed60000000fd81ce49a9480000f8163efffea1f9ae0201fa163ea1f9ae
 
 as hv1 ovs-appctl netdev-dummy/receive vif1 $ns_packet
-echo $na_packet | trim_zeros >> 1.expected
+echo $na_packet >> 1.expected
 
 sleep 1
 
@@ -3782,7 +3733,7 @@ as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int
 for i in 1 2; do
     file=hv1/vif$i-tx.pcap
     echo $file
-    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file | trim_zeros > $i.packets
+    $PYTHON "$top_srcdir/utilities/ovs-pcap.in" $file > $i.packets
     cat $i.expected > expout
     AT_CHECK([cat $i.packets], [0], [expout])
 done
-- 
2.8.1




More information about the dev mailing list