diff options
Diffstat (limited to '')
-rw-r--r-- | tools/ocft/IPaddr2v6 | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/tools/ocft/IPaddr2v6 b/tools/ocft/IPaddr2v6 new file mode 100644 index 0000000..d24d890 --- /dev/null +++ b/tools/ocft/IPaddr2v6 @@ -0,0 +1,250 @@ +# IPaddr2v6 + +# Note: This test case uses two NICs(eth0, eth1) and +# a IPv6 address prefix (2001:db8::/32, RFC3849). +# Adjust them according to your environment at VARIABLE section if needed. + +CONFIG + Agent IPaddr2 + AgentRoot /usr/lib/ocf/resource.d/heartbeat + HangTimeout 20 + +VARIABLE + OCFT_target_ip=2001:db8:1234::2 + OCFT_target_nic=eth0 + OCFT_target_prefix=64 + OCFT_target_netaddr=2001:db8:1234::1/$OCFT_target_prefix + OCFT_target_linklocal=fe80::2 + OCFT_wrong_ip=2001:db8:5678::2 + OCFT_force_nic=eth1 + OCFT_force_prefix=80 + OCFT_force_prefix2=48 + +SETUP-AGENT + ip addr add $OCFT_target_netaddr dev $OCFT_target_nic + +CLEANUP-AGENT + ip addr del $OCFT_target_netaddr dev $OCFT_target_nic + +CASE-BLOCK required_args + Env OCF_RESKEY_ip=$OCFT_target_ip + Env OCFT_check_ip=$OCFT_target_ip + Env OCFT_check_prefix=$OCFT_target_prefix + Env OCFT_check_nic=$OCFT_target_nic + +CASE-BLOCK check_ip_assigned + Bash ip -6 -o addr show $OCFT_check_nic | grep -w $OCFT_check_ip/$OCFT_check_prefix >/dev/null # checking if the IPv6 address was assigned correctly + +CASE-BLOCK check_ip_removed + Bash ! ip -6 -o addr show $OCFT_check_nic | grep -w $OCFT_check_ip/$OCFT_check_prefix >/dev/null # checking if the IPv6 address was removed correctly + +CASE-BLOCK base_ip_assigned + Bash ip addr add $OCFT_target_netaddr dev $OCFT_target_nic + +CASE-BLOCK base_ip_removed + Bash ip addr del $OCFT_target_netaddr dev $OCFT_target_nic + +CASE-BLOCK default_status + AgentRun stop + +CASE-BLOCK prepare + Include required_args + Include default_status + +# CASE No.0 +# +CASE "normal start" + Include prepare + AgentRun start OCF_SUCCESS + Include check_ip_assigned + +# CASE No.1 +# +CASE "normal stop" + Include prepare + AgentRun start OCF_SUCCESS + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.2 +# +CASE "double start" + Include prepare + AgentRun start + AgentRun start OCF_SUCCESS + +# CASE No.3 +# +CASE "double stop" + Include prepare + AgentRun stop OCF_SUCCESS + +# CASE No.4 +# +CASE "monitor with running" + Include prepare + AgentRun start + AgentRun monitor OCF_SUCCESS + +# CASE No.5 +# +CASE "monitor with not running" + Include prepare + AgentRun monitor OCF_NOT_RUNNING + +# CASE No.6 +# +CASE "error params with wrong ip" + Include prepare + Env OCF_RESKEY_ip=$OCFT_wrong_ip + AgentRun start OCF_ERR_GENERIC + +# CASE No.7 +# +CASE "error params with no nic for a link-local IPv6 address" + Include prepare + Env OCF_RESKEY_ip=$OCFT_target_linklocal + Env OCFT_check_ip=$OCFT_target_linklocal + # nic is mandatory for a link-local address + AgentRun start OCF_ERR_CONFIGURED + +# CASE No.8 +# +CASE "params with nic, no cidr_netmask" + Include prepare + Env OCF_RESKEY_nic=$OCFT_target_nic + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun monitor OCF_SUCCESS + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.9 +# +CASE "normal usage for a link-local IPv6 address, params with nic" + Include prepare + Env OCF_RESKEY_ip=$OCFT_target_linklocal + Env OCFT_check_ip=$OCFT_target_linklocal + # nic is mandatory for a link-local address + Env OCF_RESKEY_nic=$OCFT_target_nic + Env OCFT_check_nic=$OCFT_target_nic + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.10 +# +CASE "error params with wrong ip and nic (not exist base_ip)" + Include prepare + Include base_ip_removed + Env OCF_RESKEY_nic=$OCFT_target_nic + Env OCFT_check_nic=$OCFT_target_nic + AgentRun start OCF_ERR_GENERIC + Include check_ip_removed + Include base_ip_assigned + +# CASE No.11 +# +CASE "params with force nic" + Include prepare + Env OCF_RESKEY_nic=$OCFT_force_nic + Env OCFT_check_nic=$OCFT_force_nic + AgentRun start OCF_ERR_GENERIC + Include check_ip_removed + Unenv OCF_RESKEY_nic + +# CASE No.12 +# +CASE "params with force cidr_netmask" + Include prepare + Env OCF_RESKEY_cidr_netmask=$OCFT_target_prefix + Env OCFT_check_prefix=$OCFT_target_prefix + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.13 +# +CASE "params with force cidr_netmask (base netmask < assigned netmask)" + Include prepare + Env OCF_RESKEY_cidr_netmask=$OCFT_force_prefix + Env OCFT_check_prefix=$OCFT_force_prefix + AgentRun start OCF_ERR_GENERIC + Include check_ip_removed + +# CASE No.14 +# +CASE "params with force cidr_netmask (base netmask > assigned netmask)" + Include prepare + Env OCF_RESKEY_cidr_netmask=$OCFT_force_prefix2 + Env OCFT_check_prefix=$OCFT_force_prefix2 + AgentRun start OCF_ERR_GENERIC + Include check_ip_removed + +# CASE No.15 +# +CASE "params with cidr_netmask" + Include prepare + Include base_ip_removed + Env OCF_RESKEY_cidr_netmask=$OCFT_target_prefix + Env OCFT_check_prefix=$OCFT_target_prefix + AgentRun start OCF_ERR_GENERIC + Include base_ip_assigned + +# CASE No.16 +# +CASE "params with nic, cidr_netmask" + Include prepare + Env OCF_RESKEY_nic=$OCFT_target_nic + Env OCF_RESKEY_cidr_netmask=$OCFT_target_prefix + Env OCFT_check_nic=$OCFT_target_nic + Env OCFT_check_prefix=$OCFT_target_prefix + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.17 +# +CASE "force to use the specified nic and cidr_netmask (base netmask < assigned netmask)" + Include prepare + Env OCF_RESKEY_nic=$OCFT_force_nic + Env OCF_RESKEY_cidr_netmask=$OCFT_force_prefix + Env OCFT_check_nic=$OCFT_force_nic + Env OCFT_check_prefix=$OCFT_force_prefix + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.18 +# This use case is now valid. It was not allowed until v3.9.2. +# +CASE "force to use the specified nic and cidr_netmask (base netmask > assigned netmask)" + Include prepare + Env OCF_RESKEY_nic=$OCFT_force_nic + Env OCF_RESKEY_cidr_netmask=$OCFT_force_prefix2 + Env OCFT_check_nic=$OCFT_force_nic + Env OCFT_check_prefix=$OCFT_force_prefix2 + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + +# CASE No.19 +# +CASE "force to use the specified nic and cidr_netmask (base netmask > assigned netmask)" + Include prepare + Include base_ip_removed + Env OCF_RESKEY_nic=$OCFT_force_nic + Env OCF_RESKEY_cidr_netmask=$OCFT_force_prefix2 + Env OCFT_check_nic=$OCFT_force_nic + Env OCFT_check_prefix=$OCFT_force_prefix2 + AgentRun start OCF_SUCCESS + Include check_ip_assigned + AgentRun stop OCF_SUCCESS + Include check_ip_removed + Include base_ip_assigned + |