tests: Make some tests more robust.
authorJarno Rajahalme <jrajahalme@nicira.com>
Mon, 30 Dec 2013 23:42:36 +0000 (15:42 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 30 Dec 2013 23:42:36 +0000 (15:42 -0800)
These tests break if OVS internal hash function is changed.  Some of
this is due to dependency on the order in which elements are iterated
from hash maps, or the algorithm used is just dependent on the
specific hash values produced for specific inputs (groups).  These
changes make these test cases more robust, so that they will not break
so easily due to OVS internal hash function implementation changes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
tests/bfd.at
tests/ofproto-dpif.at

index 5b2d759..3723d60 100644 (file)
@@ -101,9 +101,9 @@ OVS_VSWITCHD_START(
        set bridge br-sw datapath-type=dummy \
        other-config:hwaddr=aa:55:aa:58:00:00 -- \
     add-port br-sw p1-sw -- set Interface p1-sw type=patch \
-       options:peer=p1 -- \
+       options:peer=p1 ofport_request=2 -- \
     add-port br-sw p0-sw -- set Interface p0-sw type=patch \
-       options:peer=p0 -- \
+       options:peer=p0 ofport_request=1 -- \
     add-port br-bfd1 p1 -- set Interface p1 type=patch \
        options:peer=p1-sw bfd:enable=true -- \
     add-port br-bfd0 p0 -- set Interface p0 type=patch \
index 3e74f80..730bb91 100644 (file)
@@ -148,7 +148,7 @@ AT_CLEANUP
 AT_SETUP([ofproto-dpif - select group with weight])
 OVS_VSWITCHD_START
 ADD_OF_PORTS([br0], [1], [10], [11], [12])
-AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11,weight=2,bucket=output:12,weight=0'])
+AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11,weight=2000,bucket=output:12,weight=0'])
 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
 AT_CHECK([tail -1 stdout], [0],
@@ -2454,17 +2454,10 @@ ovs-appctl time/stop
 ovs-appctl time/warp 10000
 
 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
-AT_CHECK([sed 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/' stdout], [0],
+AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
 [dnl
-OFPST_PORT reply (OF1.3) (xid=0x2): 3 ports
-  port  1: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
-           tx pkts=0, bytes=0, drop=0, errs=0, coll=0
            duration=?s
-  port  2: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
-           tx pkts=0, bytes=0, drop=0, errs=0, coll=0
            duration=?s
-  port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
-           tx pkts=0, bytes=0, drop=0, errs=0, coll=0
            duration=?s
 ])
 OVS_VSWITCHD_STOP
@@ -3010,11 +3003,9 @@ AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
        Remote Session State: down
 ])
 # bond/show should show 'may-enable: false' for p0.
-AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
+AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
        may_enable: false
        may_enable: true
-       may_enable: true
-       may_enable: true
 ])
 
 # now enable the bfd on p1 and disable bfd on p0.