Skip to content

Instantly share code, notes, and snippets.

@kskmori
Created March 1, 2018 06:27
Show Gist options
  • Save kskmori/b96103c58db64c50d04e642f261aa95a to your computer and use it in GitHub Desktop.
Save kskmori/b96103c58db64c50d04e642f261aa95a to your computer and use it in GitHub Desktop.
quick test script for resource-agents PR1109
#!/bin/sh
# quick test script for resource-agents PR1109
# https://github.com/ClusterLabs/resource-agents/pull/1109
# specify RA path for testing
#RA=./IPaddr2.org
#RA=./IPaddr2.PR1109
RA=./IPaddr2.iproute
export OCF_ROOT=/usr/lib/ocf
export OCF_RESKEY_nic=eth3
export OCF_RESKEY_cidr_netmask=64
# rfc 5952
# the first one is a correct example
# the rests are for 4.1, 4.2.1, 4.2.2, 4.2.3, 4.3
iplist="\
2001:db8::1 \
2001:db8::0001 \
2001:db8:0:0:0:0:2:1 \
2001:db8::1:1:1:1:1 \
2001:db8:0:0:1::1 \
2001:DB8::1 \
"
correctiplist="\
2001:db8::1 \
2001:db8::1 \
2001:db8::2:1 \
2001:db8:0:1:1:1:1:1 \
2001:db8::1:0:0:1 \
2001:db8::1 \
"
clear_all_ip() {
for ip in $correctiplist ; do
ip a d $ip/$OCF_RESKEY_cidr_netmask dev $OCF_RESKEY_nic >/dev/null 2>/dev/null
done
}
test_one_ip() {
export OCF_RESKEY_ip=$1
$RA start
result="OK"
$RA monitor
rc=$?
if [ $rc -ne 0 ]; then
result="NG"
fi
echo "$rc: $result"
$RA stop
}
clear_all_ip
for ip in $iplist; do
test_one_ip $ip
clear_all_ip
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment