diff options
Diffstat (limited to 'tools/ocft/IPaddr2')
-rw-r--r-- | tools/ocft/IPaddr2 | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/tools/ocft/IPaddr2 b/tools/ocft/IPaddr2 new file mode 100644 index 0000000..04698a0 --- /dev/null +++ b/tools/ocft/IPaddr2 @@ -0,0 +1,137 @@ +# IPaddr2 + +CONFIG + Agent IPaddr2 + AgentRoot /usr/lib/ocf/resource.d/heartbeat + HangTimeout 20 + +SETUP-AGENT + ip addr add 192.168.144.1/24 dev eth0 brd 192.168.144.255 + +CLEANUP-AGENT + ip addr del 192.168.144.1/24 dev eth0 + +CASE-BLOCK required_args + Env OCF_RESKEY_ip=192.168.144.2 + +CASE-BLOCK check_iflabel_assigned + Bash ip -4 -o addr show eth0 | grep -w 192.168.144.2/24 | grep -w eth0:iflabel >/dev/null # checking iflabel was assigned correctly + +CASE-BLOCK check_iflabel_removed + Bash ! ip -4 -o addr show eth0 | grep -w 192.168.144.2/24 | grep -w eth0:iflabel >/dev/null # checking iflabel was removed correctly + +CASE-BLOCK default_status + AgentRun stop + +CASE-BLOCK prepare + Include required_args + Include default_status + +CASE "check base env" + Include prepare + AgentRun start OCF_SUCCESS + +CASE "check base env: unset 'OCF_RESKEY_ip'" + Include prepare + Unenv OCF_RESKEY_ip + AgentRun start OCF_ERR_CONFIGURED + +CASE "check base env: set invalid 'OCF_RESKEY_ip'" + Include prepare + Env OCF_RESKEY_ip=not_ip_address + AgentRun start OCF_ERR_CONFIGURED + +CASE "check base env: set 'OCF_RESKEY_cidr_netmask'" + Include prepare + Env OCF_RESKEY_cidr_netmask=24 + AgentRun start OCF_SUCCESS + +CASE "check base env: set invalid 'OCF_RESKEY_cidr_netmask'" + Include prepare + Env OCF_RESKEY_cidr_netmask=not_netmask + AgentRun start OCF_ERR_CONFIGURED + +CASE "check base env: set 'OCF_RESKEY_broadcast'" + Include prepare + Env OCF_RESKEY_broadcast=192.168.144.255 + AgentRun start OCF_SUCCESS + +CASE "check base env: set invalid 'OCF_RESKEY_broadcast'" + Include prepare + Env OCF_RESKEY_broadcast=not_broadcast + AgentRun start OCF_ERR_CONFIGURED + +CASE "check base env: set 'OCF_RESKEY_nic'" + Include prepare + Env OCF_RESKEY_nic=eth0 + AgentRun start OCF_SUCCESS + +CASE "check base env: set invalid 'OCF_RESKEY_nic'" + Include prepare + Env OCF_RESKEY_nic=not_nic + AgentRun start OCF_ERR_CONFIGURED + AgentRun validate-all OCF_ERR_CONFIGURED + +CASE "normal start" + Include prepare + AgentRun start OCF_SUCCESS + +CASE "normal stop" + Include prepare + AgentRun start + AgentRun stop OCF_SUCCESS + +CASE "double start" + Include prepare + AgentRun start + AgentRun start OCF_SUCCESS + +CASE "double stop" + Include prepare + AgentRun stop OCF_SUCCESS + +CASE "monitor with running" + Include prepare + AgentRun start + AgentRun monitor OCF_SUCCESS + +CASE "monitor with not running" + Include prepare + AgentRun monitor OCF_NOT_RUNNING + +CASE "unimplemented command" + Include prepare + AgentRun no_cmd OCF_ERR_UNIMPLEMENTED + +CASE "Attachment to loopback interface" + Env OCF_RESKEY_ip=127.0.0.3 + AgentRun start OCF_SUCCESS + AgentRun monitor OCF_SUCCESS + AgentRun stop OCF_SUCCESS + +CASE "check additional env: set 'OCF_RESKEY_iflabel'" + Include prepare + Env OCF_RESKEY_nic=eth0 + Env OCF_RESKEY_iflabel=iflabel + AgentRun start OCF_SUCCESS + Include check_iflabel_assigned + AgentRun stop OCF_SUCCESS + Include check_iflabel_removed + +# This is deprecated but still supported for the compatibility. +CASE "check additional env: specify iflabel in 'OCF_RESKEY_nic'" + Include prepare + Env OCF_RESKEY_nic=eth0:iflabel + AgentRun start OCF_SUCCESS + Include check_iflabel_assigned + AgentRun stop OCF_SUCCESS + Include check_iflabel_removed + +# monitor should return OCF_ERR_GENERIC rather than OCF_ERR_CONFIGURED +# when the specified OCF_RESKEY_nic is vanished by a failure. +# This has been changed as of 3.9.6. +CASE "monitor failure when 'OCF_RESKEY_nic' is vanished" + Include prepare + Env OCF_RESKEY_nic=ethVanished + Env OCF_RESKEY_CRM_meta_interval=10 # not in probe + AgentRun monitor OCF_ERR_GENERIC |