Skip to content

Commit 94fac79

Browse files
committed
add pod
1 parent b6c0b82 commit 94fac79

File tree

3 files changed

+306
-0
lines changed

3 files changed

+306
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cloud/cs
2+
cs/group1
3+
cs/group3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
dependencies:
3+
- cs_common
Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
---
2+
- name: setup zone is present
3+
ngine_io.cloudstack.zone:
4+
name: "{{ cs_resource_prefix }}-zone"
5+
dns1: 8.8.8.8
6+
dns2: 8.8.4.4
7+
network_type: Basic
8+
register: zone
9+
- name: verify setup zone is present
10+
assert:
11+
that:
12+
- zone is successful
13+
14+
- name: setup pod is absent
15+
ngine_io.cloudstack.pod:
16+
name: "{{ cs_resource_prefix }}-pod"
17+
zone: "{{ cs_resource_prefix }}-zone"
18+
state: absent
19+
register: pod
20+
- name: verify setup pod is absent
21+
assert:
22+
that:
23+
- pod is successful
24+
25+
- name: test fail if missing name
26+
ngine_io.cloudstack.pod:
27+
zone: "{{ cs_resource_prefix }}-zone"
28+
register: pod
29+
ignore_errors: true
30+
- name: verify results of fail if missing name
31+
assert:
32+
that:
33+
- pod is failed
34+
- "pod.msg == 'missing required arguments: name'"
35+
36+
- name: test create pod in check mode
37+
ngine_io.cloudstack.pod:
38+
name: "{{ cs_resource_prefix }}-pod"
39+
zone: "{{ cs_resource_prefix }}-zone"
40+
start_ip: 10.100.10.101
41+
gateway: 10.100.10.1
42+
netmask: 255.255.255.0
43+
register: pod_origin
44+
check_mode: true
45+
- name: verify test create pod in check mode
46+
assert:
47+
that:
48+
- pod_origin is changed
49+
- pod_origin.zone == cs_resource_prefix + "-zone"
50+
51+
- name: test create pod
52+
ngine_io.cloudstack.pod:
53+
name: "{{ cs_resource_prefix }}-pod"
54+
zone: "{{ cs_resource_prefix }}-zone"
55+
start_ip: 10.100.10.101
56+
gateway: 10.100.10.1
57+
netmask: 255.255.255.0
58+
register: pod_origin
59+
- name: verify test create pod
60+
assert:
61+
that:
62+
- pod_origin is changed
63+
- pod_origin.allocation_state == "Enabled"
64+
- pod_origin.start_ip == "10.100.10.101"
65+
- pod_origin.end_ip == "10.100.10.254"
66+
- pod_origin.gateway == "10.100.10.1"
67+
- pod_origin.netmask == "255.255.255.0"
68+
- pod_origin.zone == cs_resource_prefix + "-zone"
69+
70+
- name: test create pod idempotence
71+
ngine_io.cloudstack.pod:
72+
name: "{{ cs_resource_prefix }}-pod"
73+
zone: "{{ cs_resource_prefix }}-zone"
74+
start_ip: 10.100.10.101
75+
gateway: 10.100.10.1
76+
netmask: 255.255.255.0
77+
register: pod
78+
- name: verify test create pod idempotence
79+
assert:
80+
that:
81+
- pod is not changed
82+
- pod.allocation_state == "Enabled"
83+
- pod.start_ip == "10.100.10.101"
84+
- pod.end_ip == "10.100.10.254"
85+
- pod.gateway == "10.100.10.1"
86+
- pod.netmask == "255.255.255.0"
87+
- pod.zone == cs_resource_prefix + "-zone"
88+
89+
- name: test update pod in check mode
90+
ngine_io.cloudstack.pod:
91+
name: "{{ cs_resource_prefix }}-pod"
92+
zone: "{{ cs_resource_prefix }}-zone"
93+
gateway: 10.100.10.2
94+
netmask: 255.255.255.0
95+
register: pod
96+
check_mode: true
97+
- name: verify test update pod in check mode
98+
assert:
99+
that:
100+
- pod is changed
101+
- pod.allocation_state == "Enabled"
102+
- pod.start_ip == "10.100.10.101"
103+
- pod.end_ip == "10.100.10.254"
104+
- pod.gateway == "10.100.10.1"
105+
- pod.netmask == "255.255.255.0"
106+
- pod.zone == cs_resource_prefix + "-zone"
107+
108+
- name: test update pod
109+
ngine_io.cloudstack.pod:
110+
name: "{{ cs_resource_prefix }}-pod"
111+
zone: "{{ cs_resource_prefix }}-zone"
112+
gateway: 10.100.10.2
113+
netmask: 255.255.255.0
114+
register: pod
115+
- name: verify test update pod
116+
assert:
117+
that:
118+
- pod is changed
119+
- pod.allocation_state == "Enabled"
120+
- pod.start_ip == "10.100.10.101"
121+
- pod.end_ip == "10.100.10.254"
122+
- pod.gateway == "10.100.10.2"
123+
- pod.netmask == "255.255.255.0"
124+
- pod.zone == cs_resource_prefix + "-zone"
125+
126+
- name: test update pod idempotence
127+
ngine_io.cloudstack.pod:
128+
name: "{{ cs_resource_prefix }}-pod"
129+
zone: "{{ cs_resource_prefix }}-zone"
130+
gateway: 10.100.10.2
131+
netmask: 255.255.255.0
132+
register: pod
133+
- name: verify test update pod idempotence
134+
assert:
135+
that:
136+
- pod is not changed
137+
- pod.allocation_state == "Enabled"
138+
- pod.start_ip == "10.100.10.101"
139+
- pod.end_ip == "10.100.10.254"
140+
- pod.gateway == "10.100.10.2"
141+
- pod.netmask == "255.255.255.0"
142+
- pod.zone == cs_resource_prefix + "-zone"
143+
144+
- name: test disable pod in check mode
145+
ngine_io.cloudstack.pod:
146+
name: "{{ cs_resource_prefix }}-pod"
147+
zone: "{{ cs_resource_prefix }}-zone"
148+
state: disabled
149+
register: pod
150+
check_mode: true
151+
- name: verify test enable pod in check mode
152+
assert:
153+
that:
154+
- pod is changed
155+
- pod.allocation_state == "Enabled"
156+
- pod.id == pod_origin.id
157+
- pod.start_ip == "10.100.10.101"
158+
- pod.end_ip == "10.100.10.254"
159+
- pod.gateway == "10.100.10.2"
160+
- pod.netmask == "255.255.255.0"
161+
- pod.zone == cs_resource_prefix + "-zone"
162+
163+
- name: test disable pod
164+
ngine_io.cloudstack.pod:
165+
name: "{{ cs_resource_prefix }}-pod"
166+
zone: "{{ cs_resource_prefix }}-zone"
167+
state: disabled
168+
register: pod
169+
- name: verify test enable pod
170+
assert:
171+
that:
172+
- pod is changed
173+
- pod.allocation_state == "Disabled"
174+
- pod.id == pod_origin.id
175+
- pod.start_ip == "10.100.10.101"
176+
- pod.end_ip == "10.100.10.254"
177+
- pod.gateway == "10.100.10.2"
178+
- pod.netmask == "255.255.255.0"
179+
- pod.zone == cs_resource_prefix + "-zone"
180+
181+
- name: test disable pod idempotence
182+
ngine_io.cloudstack.pod:
183+
name: "{{ cs_resource_prefix }}-pod"
184+
zone: "{{ cs_resource_prefix }}-zone"
185+
state: disabled
186+
register: pod
187+
- name: verify test enable pod idempotence
188+
assert:
189+
that:
190+
- pod is not changed
191+
- pod.allocation_state == "Disabled"
192+
- pod.id == pod_origin.id
193+
- pod.start_ip == "10.100.10.101"
194+
- pod.end_ip == "10.100.10.254"
195+
- pod.gateway == "10.100.10.2"
196+
- pod.netmask == "255.255.255.0"
197+
- pod.zone == cs_resource_prefix + "-zone"
198+
199+
- name: test enable pod in check mode
200+
ngine_io.cloudstack.pod:
201+
name: "{{ cs_resource_prefix }}-pod"
202+
zone: "{{ cs_resource_prefix }}-zone"
203+
state: enabled
204+
register: pod
205+
check_mode: true
206+
- name: verify test disable pod in check mode
207+
assert:
208+
that:
209+
- pod is changed
210+
- pod.allocation_state == "Disabled"
211+
- pod.id == pod_origin.id
212+
- pod.start_ip == "10.100.10.101"
213+
- pod.end_ip == "10.100.10.254"
214+
- pod.gateway == "10.100.10.2"
215+
- pod.netmask == "255.255.255.0"
216+
- pod.zone == cs_resource_prefix + "-zone"
217+
218+
- name: test enable pod
219+
ngine_io.cloudstack.pod:
220+
name: "{{ cs_resource_prefix }}-pod"
221+
zone: "{{ cs_resource_prefix }}-zone"
222+
state: enabled
223+
register: pod
224+
- name: verify test disable pod
225+
assert:
226+
that:
227+
- pod is changed
228+
- pod.allocation_state == "Enabled"
229+
- pod.id == pod_origin.id
230+
- pod.start_ip == "10.100.10.101"
231+
- pod.end_ip == "10.100.10.254"
232+
- pod.gateway == "10.100.10.2"
233+
- pod.netmask == "255.255.255.0"
234+
- pod.zone == cs_resource_prefix + "-zone"
235+
236+
- name: test enable pod idempotence
237+
ngine_io.cloudstack.pod:
238+
name: "{{ cs_resource_prefix }}-pod"
239+
zone: "{{ cs_resource_prefix }}-zone"
240+
state: enabled
241+
register: pod
242+
- name: verify test enabled pod idempotence
243+
assert:
244+
that:
245+
- pod is not changed
246+
- pod.allocation_state == "Enabled"
247+
- pod.id == pod_origin.id
248+
- pod.start_ip == "10.100.10.101"
249+
- pod.end_ip == "10.100.10.254"
250+
- pod.gateway == "10.100.10.2"
251+
- pod.netmask == "255.255.255.0"
252+
- pod.zone == cs_resource_prefix + "-zone"
253+
254+
- name: test absent pod in check mode
255+
ngine_io.cloudstack.pod:
256+
name: "{{ cs_resource_prefix }}-pod"
257+
zone: "{{ cs_resource_prefix }}-zone"
258+
state: absent
259+
register: pod
260+
check_mode: true
261+
- name: verify test create pod in check mode
262+
assert:
263+
that:
264+
- pod is changed
265+
- pod.id == pod_origin.id
266+
- pod.allocation_state == "Enabled"
267+
- pod.start_ip == "10.100.10.101"
268+
- pod.end_ip == "10.100.10.254"
269+
- pod.gateway == "10.100.10.2"
270+
- pod.netmask == "255.255.255.0"
271+
- pod.zone == cs_resource_prefix + "-zone"
272+
273+
- name: test absent pod
274+
ngine_io.cloudstack.pod:
275+
name: "{{ cs_resource_prefix }}-pod"
276+
zone: "{{ cs_resource_prefix }}-zone"
277+
state: absent
278+
register: pod
279+
- name: verify test create pod
280+
assert:
281+
that:
282+
- pod is changed
283+
- pod.id == pod_origin.id
284+
- pod.allocation_state == "Enabled"
285+
- pod.start_ip == "10.100.10.101"
286+
- pod.end_ip == "10.100.10.254"
287+
- pod.gateway == "10.100.10.2"
288+
- pod.netmask == "255.255.255.0"
289+
- pod.zone == cs_resource_prefix + "-zone"
290+
291+
- name: test absent pod idempotence
292+
ngine_io.cloudstack.pod:
293+
name: "{{ cs_resource_prefix }}-pod"
294+
zone: "{{ cs_resource_prefix }}-zone"
295+
state: absent
296+
register: pod
297+
- name: verify test absent pod idempotence
298+
assert:
299+
that:
300+
- pod is not changed

0 commit comments

Comments
 (0)