smbd: brl_lock_cancel does not need "blr" anymore
[Samba.git] / ctdb / tests / complex / 33_gratuitous_arp.sh
blob721b0f2a348bb3361350e47ae0a9a3c7174d906d
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that a gratuitous ARP is sent when a node is failed out.
8 We ping a public IP and lookup the MAC address in the ARP table. We
9 then disable the node and check the ARP table again - the MAC address
10 should have changed. This test does NOT test connectivity after the
11 failover.
13 Prerequisites:
15 * An active CTDB cluster with at least 2 nodes with public addresses.
17 * Test must be run on a real or virtual cluster rather than against
18 local daemons.
20 * Test must not be run from a cluster node.
22 Steps:
24 1. Verify that the cluster is healthy.
25 2. Select a public address and its corresponding node.
26 3. Remove any entries for the chosen address from the ARP table.
27 4. Send a single ping request packet to the selected public address.
28 5. Determine the MAC address corresponding to the public address by
29 checking the ARP table.
30 6. Disable the selected node.
31 7. Check the ARP table and check the MAC associated with the public
32 address.
34 Expected results:
36 * When a node is disabled the MAC address associated with public
37 addresses on that node should change.
38 EOF
41 . "${TEST_SCRIPTS_DIR}/integration.bash"
43 set -e
45 ctdb_test_init "$@"
47 ctdb_test_check_real_cluster
49 cluster_is_healthy
51 # Reset configuration
52 ctdb_restart_when_done
54 select_test_node_and_ips
56 echo "Removing ${test_ip} from the local ARP table..."
57 arp -d $test_ip >/dev/null 2>&1 || true
59 echo "Pinging ${test_ip}..."
60 ping -q -n -c 1 $test_ip
62 echo "Getting MAC address associated with ${test_ip}..."
63 original_mac=$(arp -n $test_ip | awk '$2 == "ether" {print $3}')
64 [ $? -eq 0 ]
66 echo "MAC address is: ${original_mac}"
68 gratarp_sniff_start
70 echo "Disabling node $test_node"
71 try_command_on_node 1 $CTDB disable -n $test_node
72 wait_until_node_has_status $test_node disabled
74 gratarp_sniff_wait_show
76 echo "Getting MAC address associated with ${test_ip} again..."
77 new_mac=$(arp -n $test_ip | awk '$2 == "ether" {print $3}')
78 [ $? -eq 0 ]
80 echo "MAC address is: ${new_mac}"
82 if [ "$original_mac" != "$new_mac" ] ; then
83 echo "GOOD: MAC address changed"
84 else
85 echo "BAD: MAC address did not change"
86 testfailures=1