cfm: Add test for fault_override
authorJoe Stringer <joestringer@nicira.com>
Mon, 16 Dec 2013 18:08:08 +0000 (10:08 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 17 Dec 2013 23:57:36 +0000 (15:57 -0800)
This patch adds tests for the cfm fault_override feature which can be
set through "ovs-appctl cfm/set-fault <port> <value>". It brings up two
ports with CFM, sets a fault, then checks that the fault status has
propagated correctly to the CFM module and the database. Finally, it
sets the fault override behaviour to normal and checks that the fault
has gone away.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/cfm.at

index 9f9591d..7ab4354 100644 (file)
@@ -94,5 +94,43 @@ AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
 for i in `seq 0 10`; do ovs-appctl time/warp 100; done
 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count      : 2])
 
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([cfm - fault_override])
+OVS_VSWITCHD_START([add-br br1 -- \
+                    set bridge br1 datapath-type=dummy \
+                    other-config:hwaddr=aa:55:aa:56:00:00 -- \
+                    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 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
+                    set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
+
+ovs-appctl time/stop
+# wait for a while to stablize cfm.
+for i in `seq 0 100`; do ovs-appctl time/warp 100; done
+CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
+CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
+AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
+CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status    : [[]]])
+
+# set a fault and see that this is shown in the CFM module and the database
+AT_CHECK([ovs-appctl cfm/set-fault p1 true], [0], [OK
+])
+AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
+AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override' | sed -e 's/MPID [[0-9]]*: extended //'], [0], [dnl
+fault_override
+])
+CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status    : [[override]]])
+
+# reset and see that it returned to normal
+AT_CHECK([ovs-appctl cfm/set-fault normal], [0], [OK
+])
+AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
+AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
+CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status    : [[]]])
+
 OVS_VSWITCHD_STOP
 AT_CLEANUP
\ No newline at end of file