Signed-off-by: Pavithra Ramesh <param...@vmware.com> --- tests/automake.mk | 1 + tests/bfd.at | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testsuite.at | 1 + 3 files changed, 216 insertions(+), 0 deletions(-) create mode 100644 tests/bfd.at
diff --git a/tests/automake.mk b/tests/automake.mk index 4442eb5..ea330e0 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -9,6 +9,7 @@ TESTSUITE_AT = \ tests/ovsdb-macros.at \ tests/library.at \ tests/heap.at \ + tests/bfd.at \ tests/bundle.at \ tests/classifier.at \ tests/check-structs.at \ diff --git a/tests/bfd.at b/tests/bfd.at new file mode 100644 index 0000000..0230c39 --- /dev/null +++ b/tests/bfd.at @@ -0,0 +1,214 @@ +AT_BANNER([bfd]) + +AT_SETUP([bfd - basic config on different bridges]) +#Create 2 bridges connected by patch ports and enable BFD +OVS_VSWITCHD_START( + [add-br br1 -- \ + set bridge br1 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543211 \ + other-config:hwaddr=aa:55:aa:56:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-port br1 p1 -- set Interface p1 type=patch \ + options:peer=p0 -- \ + add-port br0 p0 -- set Interface p0 type=patch \ + options:peer=p1 -- \ + set Interface p0 bfd:enable=true -- \ + set Interface p1 bfd:enable=true ]) +for i in `seq 0 20`; do ovs-appctl time/warp 100; done + +#Verify that BFD has been enabled on both interfaces. +AT_CHECK([ ovs-appctl bfd/show p1 | grep "Local Session State: up" ], [0], [ignore], [ignore]) +AT_CHECK([ ovs-appctl bfd/show p0 | grep "Local Session State: up" ], [0], [ignore], [ignore]) + +#Delete the bridge and make sure the bfd entries are gone too. +AT_CHECK([ovs-vsctl del-br br0], [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl del-br br1], [0], [ignore], [ignore]) +#Check that the entries are gone. +AT_CHECK([ ovs-appctl bfd/show p1 ], [1], [ignore], [ignore]) +AT_CHECK([ ovs-appctl bfd/show p0 ], [1], [ignore], [ignore]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([bfd - Verify tunnel down detection]) +#Create 3 bridges - br-bfd0, br-bfd1 and br-sw which is midway between the two. br2 is +#connected to br-bfd0 and br-bfd1 through patch ports p0-2 and p1-2. Enable BFD on +#interfaces in br-bfd0 and br-bfd1. When br-sw is dropping all packets, BFD should detect +# that the tunnel is down, and come back up when br-sw is working fine. +OVS_VSWITCHD_START( + [add-br br-bfd0 -- \ + set bridge br-bfd0 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543211 \ + other-config:hwaddr=aa:55:aa:56:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-br br-bfd1 -- \ + set bridge br-bfd1 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543212 \ + other-config:hwaddr=aa:55:aa:57:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-br br-sw -- \ + set bridge br-sw datapath-type=dummy \ + other-config:datapath-id=fedcba9876543213 \ + other-config:hwaddr=aa:55:aa:58:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-port br-sw p1-sw -- set Interface p1-sw type=patch \ + options:peer=p1 -- \ + add-port br-sw p0-sw -- set Interface p0-sw type=patch \ + options:peer=p0 -- \ + 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 \ + options:peer=p0-sw bfd:enable=true --]) + +AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL']) +#Verify that BFD is enabled. +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p0 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p1 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) + +#Drop all packets in the br-sw bridge so that the tunnel is down. +AT_CHECK([ ovs-ofctl add-flow br-sw 'priority=5,actions=drop' ],[0], [ignore], [ignore]) +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p1 | grep '{diagnostic="Control Detection Time Expired", forwarding="false", state=down'], [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p0 | grep '{diagnostic="Control Detection Time Expired", forwarding="false", state=down'], [0], [ignore], [ignore]) +#Delete the added flow +AT_CHECK([ovs-ofctl del-flows br-sw]) +AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL']) +#Verify that BFD is back up again. +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p1 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p0 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +OVS_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([bfd - Verify one-side tunnel down detection]) +#Create 3 bridges - br-bfd0, br-bfd1 and br-sw which is midway between the two. br2 is +#connected to br-bfd0 and br-bfd1 through patch ports p0-2 and p1-2. Enable BFD on +#interfaces in br-bfd0 and br-bfd1. When br-sw is dropping packets from one end, BFD should detect +# that the tunnel is down, and come back up when br-sw is working fine. +OVS_VSWITCHD_START( + [add-br br-bfd0 -- \ + set bridge br-bfd0 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543211 \ + other-config:hwaddr=aa:55:aa:56:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-br br-bfd1 -- \ + set bridge br-bfd1 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543212 \ + other-config:hwaddr=aa:55:aa:57:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-br br-sw -- \ + set bridge br-sw datapath-type=dummy \ + other-config:datapath-id=fedcba9876543213 \ + other-config:hwaddr=aa:55:aa:58:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure -- \ + add-port br-sw p1-sw -- set Interface p1-sw type=patch \ + options:peer=p1 -- \ + add-port br-sw p0-sw -- set Interface p0-sw type=patch \ + options:peer=p0 -- \ + 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 \ + options:peer=p0-sw bfd:enable=true --]) + +AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL']) +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p0 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p1 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) + + +#Bring down the br-bfd1 - br-sw link +AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=1,priority=5,actions=drop' ],[0], [ignore], [ignore]) +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ ovs-ofctl dump-flows br-sw ], [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p1 | grep '{diagnostic="Control Detection Time Expired", forwarding="false", state=down' + ], [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p0 | grep 'diagnostic="Neighbor Signaled Session Down", forwarding="false", + remote_diagnostic="Control Detection Time Expired", remote_state=down, state=init' +], [0], [ignore], [ignore]) + +AT_CHECK([ovs-ofctl del-flows br-sw]) +AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL']) +#Ensure that BFD is back up again. + +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p1 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p0 | grep 'remote_state=up, state=up'], + [0], [ignore], [ignore]) +#Bring down the br-bfd0 - br-sw link +AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=2,priority=5,actions=drop' ],[0], [ignore], [ignore]) +for i in `seq 0 40`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p0 | grep '{diagnostic="Control Detection Time Expired", forwarding="false", state=down' + ], [0], [ignore], [ignore]) +AT_CHECK([ovs-vsctl list interface p1 | grep 'diagnostic="Neighbor Signaled Session Down", forwarding="false", remote_diagnostic="Control Detection Time Expired", remote_state=down, state=init' +], [0], [ignore], [ignore]) +OVS_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([bfd - concatenated path down]) +#Create 2 bridges connected by patch ports and enable BFD +OVS_VSWITCHD_START() +AT_CHECK([ ovs-vsctl -- add-br br1 -- \ + set bridge br1 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543211 \ + other-config:hwaddr=aa:55:aa:56:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure ]) +AT_CHECK([ ovs-vsctl -- add-port br1 p1 -- set Interface p1 type=patch \ + options:peer=p0 ]) +AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \ + options:peer=p1 ]) +AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ]) +AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ]) +for i in `seq 0 20`; do ovs-appctl time/warp 100; done + +#Verify that BFD has been enabled on both interfaces. +AT_CHECK([ ovs-appctl bfd/show p1 | grep "Local Session State: up" ], [0], [ignore], [ignore]) +AT_CHECK([ ovs-appctl bfd/show p0 | grep "Local Session State: up" ], [0], [ignore], [ignore]) +#Set cpath_down to true on one interface, make sure the remote interface updates its values. +AT_CHECK([ovs-vsctl set interface p0 bfd:cpath_down=true], [0], [ignore], [ignore]) +for i in `seq 0 20`; do ovs-appctl time/warp 100; done +AT_CHECK([ovs-vsctl list interface p1 | grep '{diagnostic="No Diagnostic", forwarding="false", remote_diagnostic="Concatenated Path Down", remote_state=up, state=up}'],[0], [ignore], [ignore]) +OVS_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([bfd - Edit the Min Tx/Rx values]) +#Create 2 bridges connected by patch ports and enable BFD +OVS_VSWITCHD_START() +AT_CHECK([ ovs-vsctl -- add-br br1 -- \ + set bridge br1 datapath-type=dummy \ + other-config:datapath-id=fedcba9876543211 \ + other-config:hwaddr=aa:55:aa:56:00:00 \ + protocols=[[OpenFlow10,OpenFlow12,OpenFlow13]] fail-mode=secure ]) +AT_CHECK([ ovs-vsctl -- add-port br1 p1 -- set Interface p1 type=patch \ + options:peer=p0 ]) +AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \ + options:peer=p1 ]) +AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ]) +AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ]) +for i in `seq 0 20`; do ovs-appctl time/warp 100; done +#Verify that BFD has been enabled on both interfaces. +AT_CHECK([ ovs-appctl bfd/show p1 | grep "Local Session State: up" ], [0], [ignore], [ignore]) +AT_CHECK([ ovs-appctl bfd/show p0 | grep "Local Session State: up" ], [0], [ignore], [ignore]) +#Edit the min Tx value. +AT_CHECK([ovs-vsctl set interface p0 bfd:min_tx=200], [0], [ignore], [ignore]) +AT_CHECK([ovs-appctl bfd/show p0 | grep "Local Minimum TX Interval: 200ms"], [0], [ignore], [ignore]) +AT_CHECK([ovs-appctl bfd/show p1 | grep "Remote Minimum TX Interval: 200ms"], [0], [ignore], [ignore]) + +#Edit the min Rx value. +AT_CHECK([ovs-vsctl set interface p1 bfd:min_rx=300], [0], [ignore], [ignore]) +AT_CHECK([ovs-appctl bfd/show p1 | grep "Local Minimum RX Interval: 300ms"], [0], [ignore], [ignore]) +AT_CHECK([ovs-appctl bfd/show p0 | grep "Remote Minimum RX Interval: 300ms"], [0], [ignore], [ignore]) + +OVS_VSWITCHD_STOP +AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index da52593..6ba897e 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -67,6 +67,7 @@ EOF m4_include([tests/ovsdb-macros.at]) m4_include([tests/ofproto-macros.at]) +m4_include([tests/bfd.at]) m4_include([tests/lacp.at]) m4_include([tests/library.at]) m4_include([tests/heap.at]) -- 1.7.0.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev