summaryrefslogtreecommitdiffstats
path: root/tools/ocft/IPaddr2
blob: 04698a0560ec7dc611e922adce87bc0b1233b815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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