[ovs-dev] [PATCH] ovn: Replace tabs with spaces and clean up alignment in unit tests.

Justin Pettit jpettit at ovn.org
Wed Jun 8 02:05:38 UTC 2016


Signed-off-by: Justin Pettit <jpettit at ovn.org>
---
 tests/ovn-controller.at |   4 +-
 tests/ovn.at            | 323 ++++++++++++++++++++++++------------------------
 2 files changed, 164 insertions(+), 163 deletions(-)

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 13b3f53..d6daa24 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -21,14 +21,14 @@ check_patches () {
     echo 'ovs-vsctl -f csv -d bare --no-headings --columns=name find Interface type=patch | sort' > query
     for patch
     do
-	echo $patch
+        echo $patch
     done | cut -d' ' -f 2 | sort > expout
 
     # Generate code to verify that the configuration of each patch
     # port is correct.
     for patch
     do
-	set $patch; bridge=$1 port=$2 peer=$3
+        set $patch; bridge=$1 port=$2 peer=$3
         echo >>query "ovs-vsctl iface-to-br $port -- get Interface $port type options"
         echo >>expout "$bridge
 patch
diff --git a/tests/ovn.at b/tests/ovn.at
index 633cf35..c45e1e7 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -1252,13 +1252,14 @@ for i in 1 2 3; do
     ovn-nbctl lswitch-add ls$i
     for j in 1 2 3; do
         for k in 1 2 3; do
-	    # Add "unknown" to MAC addresses for lp?11, so packets for
-	    # MAC-IP bindings discovered via ARP later have somewhere to go.
-	    if test $j$k = 11; then unknown=unknown; else unknown=; fi
-
-	    ovn-nbctl \
-		-- lport-add ls$i lp$i$j$k \
-		-- lport-set-addresses lp$i$j$k "f0:00:00:00:0$i:$j$k 192.168.$i$j.$k" $unknown
+            # Add "unknown" to MAC addresses for lp?11, so packets for
+            # MAC-IP bindings discovered via ARP later have somewhere to go.
+            if test $j$k = 11; then unknown=unknown; else unknown=; fi
+
+            ovn-nbctl \
+                -- lport-add ls$i lp$i$j$k \
+                -- lport-set-addresses lp$i$j$k "f0:00:00:00:0$i:$j$k \
+                   192.168.$i$j.$k" $unknown
         done
     done
 done
@@ -1266,15 +1267,15 @@ done
 ovn-nbctl create Logical_Router name=lr0
 for i in 1 2 3; do
     for j in 1 2 3; do
-	lrp_uuid=`ovn-nbctl \
-	    -- --id=@lrp create Logical_Router_Port name=lrp$i$j \
-	       network=192.168.$i$j.254/24 mac='"00:00:00:00:ff:'$i$j'"' \
-	    -- add Logical_Router lr0 ports @lrp \
-	    -- lport-add ls$i lrp$i$j-attachment`
-	ovn-nbctl \
-	    set Logical_Port lrp$i$j-attachment type=router \
-                             options:router-port=lrp$i$j \
-                             addresses='"00:00:00:00:ff:'$i$j'"'
+        lrp_uuid=`ovn-nbctl \
+            -- --id=@lrp create Logical_Router_Port name=lrp$i$j \
+               network=192.168.$i$j.254/24 mac='"00:00:00:00:ff:'$i$j'"' \
+            -- add Logical_Router lr0 ports @lrp \
+            -- lport-add ls$i lrp$i$j-attachment`
+        ovn-nbctl \
+            set Logical_Port lrp$i$j-attachment type=router \
+                                 options:router-port=lrp$i$j \
+                                 addresses='"00:00:00:00:ff:'$i$j'"'
     done
 done
 
@@ -1321,14 +1322,14 @@ done
 for i in 1 2 3; do
     for j in 1 2 3; do
         for k in 1 2 3; do
-	    hv=`vif_to_hv $i$j$k`
-	    as hv$hv ovs-vsctl \
-		-- add-port br-int vif$i$j$k \
-		-- set Interface vif$i$j$k \
-		       external-ids:iface-id=lp$i$j$k \
-		       options:tx_pcap=hv$hv/vif$i$j$k-tx.pcap \
-		       options:rxq_pcap=hv$hv/vif$i$j$k-rx.pcap \
-		       ofport-request=$i$j$k
+            hv=`vif_to_hv $i$j$k`
+                as hv$hv ovs-vsctl \
+                -- add-port br-int vif$i$j$k \
+                -- set Interface vif$i$j$k \
+                    external-ids:iface-id=lp$i$j$k \
+                    options:tx_pcap=hv$hv/vif$i$j$k-tx.pcap \
+                    options:rxq_pcap=hv$hv/vif$i$j$k-rx.pcap \
+                    ofport-request=$i$j$k
         done
     done
 done
@@ -1356,7 +1357,7 @@ for i in 1 2 3; do
     for j in 1 2 3; do
         for k in 1 2 3; do
             : > $i$j$k.expected
-	done
+        done
     done
 done
 test_ip() {
@@ -1370,14 +1371,14 @@ test_ip() {
     in_ls=`vif_to_ls $inport`
     in_lrp=`vif_to_lrp $inport`
     for outport; do
-	out_ls=`vif_to_ls $outport`
+        out_ls=`vif_to_ls $outport`
         if test $in_ls = $out_ls; then
             # Ports on the same logical switch receive exactly the same packet.
             echo $packet
         else
             # Routing decrements TTL and updates source and dest MAC
             # (and checksum).
-	    out_lrp=`vif_to_lrp $outport`
+            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
     done
@@ -1399,29 +1400,29 @@ ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
 }
 for is in 1 2 3; do
-    for js in 1 2 3; do
-	for ks in 1 2 3; do
-	    bcast=
-	    s=$is$js$ks
-	    smac=f00000000$s
-	    sip=`ip_to_hex 192 168 $is$js $ks`
-	    for id in 1 2 3; do
-		for jd in 1 2 3; do
-                    for kd in 1 2 3; do
-			d=$id$jd$kd
-			dip=`ip_to_hex 192 168 $id$jd $kd`
-			if test $is = $id; then dmac=f00000000$d; else dmac=00000000ff$is$js; fi
-			if test $d != $s; then unicast=$d; else unicast=; fi
-
-			test_ip $s $smac $dmac $sip $dip $unicast #1
-
-			if test $id = $is && test $d != $s; then bcast="$bcast $d"; fi
-                    done
-		done
-	    done
-	    test_ip $s $smac ffffffffffff $sip ffffffff $bcast #2
+  for js in 1 2 3; do
+    for ks in 1 2 3; do
+      bcast=
+      s=$is$js$ks
+      smac=f00000000$s
+      sip=`ip_to_hex 192 168 $is$js $ks`
+      for id in 1 2 3; do
+          for jd in 1 2 3; do
+              for kd in 1 2 3; do
+                d=$id$jd$kd
+                dip=`ip_to_hex 192 168 $id$jd $kd`
+                if test $is = $id; then dmac=f00000000$d; else dmac=00000000ff$is$js; fi
+                if test $d != $s; then unicast=$d; else unicast=; fi
+
+                test_ip $s $smac $dmac $sip $dip $unicast #1
+
+                if test $id = $is && test $d != $s; then bcast="$bcast $d"; fi
+              done
+          done
         done
-    done
+      test_ip $s $smac ffffffffffff $sip ffffffff $bcast #2
+      done
+  done
 done
 
 # 3. Send an IP packet from every logical port to every other subnet,
@@ -1429,41 +1430,41 @@ done
 #    This should generate a broadcast ARP request for the destination
 #    IP address in the destination subnet.
 for is in 1 2 3; do
-    for js in 1 2 3; do
-	for ks in 1 2 3; do
-	    s=$is$js$ks
-	    smac=f00000000$s
-	    sip=`ip_to_hex 192 168 $is$js $ks`
-	    for id in 1 2 3; do
-		for jd in 1 2 3; do
-		    if test $is$js = $id$jd; then
-		        continue
-                    fi
-
-		    # Send the packet.
-		    dmac=00000000ff$is$js
-		    # Calculate a 4th octet for the destination that is
-		    # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
-		    # that have static MAC bindings, and fits in the range
-		    # 0-255.
-		    o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
-		    dip=`ip_to_hex 192 168 $id$jd $o4`
-		    test_ip $s $smac $dmac $sip $dip
-
-		    # Every LP on the destination subnet's lswitch should
-		    # receive the ARP request.
-		    lrmac=00000000ff$id$jd
-		    lrip=`ip_to_hex 192 168 $id$jd 254`
-		    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
-			done
-		    done
-		done
+  for js in 1 2 3; do
+    for ks in 1 2 3; do
+      s=$is$js$ks
+      smac=f00000000$s
+      sip=`ip_to_hex 192 168 $is$js $ks`
+      for id in 1 2 3; do
+        for jd in 1 2 3; do
+          if test $is$js = $id$jd; then
+            continue
+          fi
+
+          # Send the packet.
+          dmac=00000000ff$is$js
+          # Calculate a 4th octet for the destination that is
+          # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
+          # that have static MAC bindings, and fits in the range
+          # 0-255.
+          o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
+          dip=`ip_to_hex 192 168 $id$jd $o4`
+          test_ip $s $smac $dmac $sip $dip
+
+          # Every LP on the destination subnet's lswitch should
+          # receive the ARP request.
+          lrmac=00000000ff$id$jd
+          lrip=`ip_to_hex 192 168 $id$jd 254`
+          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
             done
+          done
         done
+      done
     done
+  done
 done
 
 # test_arp INPORT SHA SPA TPA [REPLY_HA]
@@ -1516,19 +1517,19 @@ test_arp() {
 #
 # 7. No reply to query for IP address other than router IP.
 for i in 1 2 3; do
-    for j in 1 2 3; do
-        for k in 1 2 3; do
-	    smac=f00000000$i$j$k               # Source MAC
-	    sip=`ip_to_hex 192 168 $i$j $k`    # Source IP
-	    rip=`ip_to_hex 192 168 $i$j 254`   # Router IP
-	    rmac=00000000ff$i$j                # Router MAC
-	    otherip=`ip_to_hex 192 168 $i$j 55` # Some other IP in subnet
-	    test_arp $i$j$k $smac $sip        $rip        $rmac #4
-	    test_arp $i$j$k $smac $otherip    $rip        $rmac #5
-	    test_arp $i$j$k $smac 0a123456    $rip        $rmac #6
-	    test_arp $i$j$k $smac $sip        $otherip          #7
-        done
+  for j in 1 2 3; do
+    for k in 1 2 3; do
+      smac=f00000000$i$j$k               # Source MAC
+      sip=`ip_to_hex 192 168 $i$j $k`    # Source IP
+      rip=`ip_to_hex 192 168 $i$j 254`   # Router IP
+      rmac=00000000ff$i$j                # Router MAC
+      otherip=`ip_to_hex 192 168 $i$j 55` # Some other IP in subnet
+      test_arp $i$j$k $smac $sip        $rip        $rmac #4
+      test_arp $i$j$k $smac $otherip    $rip        $rmac #5
+      test_arp $i$j$k $smac 0a123456    $rip        $rmac #6
+      test_arp $i$j$k $smac $sip        $otherip          #7
     done
+  done
 done
 
 # Allow some time for packet forwarding.
@@ -1543,42 +1544,42 @@ sleep 1
 #    it means that $s and $d are the same as #3.
 : > mac_bindings.expected
 for is in 1 2 3; do
-    for js in 1 2 3; do
-	for ks in 1 2 3; do
-	    s=$is$js$ks
-	    for id in 1 2 3; do
-		for jd in 1 2 3; do
-		    if test $is$js = $id$jd; then
-		        continue
-                    fi
-
-		    kd=1
-		    d=$id$jd$kd
-
-		    o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
-		    host_ip=`ip_to_hex 192 168 $id$jd $o4`
-		    host_mac=8000000000$o4
-
-		    lrmac=00000000ff$id$jd
-		    lrip=`ip_to_hex 192 168 $id$jd 254`
-
-		    arp=${lrmac}${host_mac}08060001080006040002${host_mac}${host_ip}${lrmac}${lrip}
-
-		    echo
-		    echo
-		    echo
-                    hv=hv`vif_to_hv $d`
-		    as $hv ovs-appctl netdev-dummy/receive vif$d $arp
-		    #as $hv ovs-appctl ofproto/trace br-int in_port=$d $arp
-		    #as $hv ovs-ofctl dump-flows br-int table=19
-
-		    host_ip_pretty=192.168.$id$jd.$o4
-		    host_mac_pretty=80:00:00:00:00:$o4
-		    echo lrp$id$jd,$host_ip_pretty,$host_mac_pretty >> mac_bindings.expected
-		done
-            done
+  for js in 1 2 3; do
+    for ks in 1 2 3; do
+      s=$is$js$ks
+      for id in 1 2 3; do
+        for jd in 1 2 3; do
+          if test $is$js = $id$jd; then
+            continue
+          fi
+
+          kd=1
+          d=$id$jd$kd
+
+          o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
+          host_ip=`ip_to_hex 192 168 $id$jd $o4`
+          host_mac=8000000000$o4
+
+          lrmac=00000000ff$id$jd
+          lrip=`ip_to_hex 192 168 $id$jd 254`
+
+          arp=${lrmac}${host_mac}08060001080006040002${host_mac}${host_ip}${lrmac}${lrip}
+
+          echo
+          echo
+          echo
+          hv=hv`vif_to_hv $d`
+          as $hv ovs-appctl netdev-dummy/receive vif$d $arp
+          #as $hv ovs-appctl ofproto/trace br-int in_port=$d $arp
+          #as $hv ovs-ofctl dump-flows br-int table=19
+
+          host_ip_pretty=192.168.$id$jd.$o4
+          host_mac_pretty=80:00:00:00:00:$o4
+          echo lrp$id$jd,$host_ip_pretty,$host_mac_pretty >> mac_bindings.expected
         done
+      done
     done
+  done
 done
 
 # Allow some time for packet forwarding.
@@ -1592,36 +1593,36 @@ sleep 1
 #    have static MAC bindings, so they go to the port we've designated as
 #    accepting "unknown" MACs.)
 for is in 1 2 3; do
-    for js in 1 2 3; do
-	for ks in 1 2 3; do
-	    s=$is$js$ks
-	    smac=f00000000$s
-	    sip=`ip_to_hex 192 168 $is$js $ks`
-	    for id in 1 2 3; do
-		for jd in 1 2 3; do
-		    if test $is$js = $id$jd; then
-		        continue
-                    fi
-
-		    # Send the packet.
-		    dmac=00000000ff$is$js
-		    # Calculate a 4th octet for the destination that is
-		    # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
-		    # that have static MAC bindings, and fits in the range
-		    # 0-255.
-		    o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
-		    dip=`ip_to_hex 192 168 $id$jd $o4`
-		    test_ip $s $smac $dmac $sip $dip
-
-		    # Expect the packet egress.
-		    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
-		done
-            done
+  for js in 1 2 3; do
+    for ks in 1 2 3; do
+      s=$is$js$ks
+      smac=f00000000$s
+      sip=`ip_to_hex 192 168 $is$js $ks`
+      for id in 1 2 3; do
+        for jd in 1 2 3; do
+          if test $is$js = $id$jd; then
+            continue
+          fi
+
+          # Send the packet.
+          dmac=00000000ff$is$js
+          # Calculate a 4th octet for the destination that is
+          # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
+          # that have static MAC bindings, and fits in the range
+          # 0-255.
+          o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
+          dip=`ip_to_hex 192 168 $id$jd $o4`
+          test_ip $s $smac $dmac $sip $dip
+
+          # Expect the packet egress.
+          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
         done
+      done
     done
+  done
 done
 
 # Allow some time for packet forwarding.
@@ -1635,12 +1636,12 @@ ovn-sbctl -f csv -d bare --no-heading \
 for i in 1 2 3; do
     for j 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
-	    sort $i$j$k.expected > expout
-	    AT_CHECK([sort $i$j$k.packets], [0], [expout])
-	    echo
+            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
+            sort $i$j$k.expected > expout
+            AT_CHECK([sort $i$j$k.packets], [0], [expout])
+            echo
         done
     done
 done
-- 
1.9.1




More information about the dev mailing list