summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/cs_vpc_offering/tasks/main.yml
blob: ebbeaf910a93da6e1feba84c56caf8ed492568d0 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
---
- name: setup
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: absent
  register: vpcoffer
- name: verify setup
  assert:
    that:
    - vpcoffer is successful

- name: test fail if missing name
  cs_vpc_offering:
  register: vpcoffer
  ignore_errors: true
- name: verify results of fail if missing name
  assert:
    that:
    - vpcoffer is failed
    - 'vpcoffer.msg == "missing required arguments: name"'

- name: test fail if missing params
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
  register: vpcoffer
  ignore_errors: true
- name: verify results of fail if missing params
  assert:
    that:
    - vpcoffer is failed
    - 'vpcoffer.msg == "missing required arguments: display_text, supported_services"'

- name: test create vpc offer in check mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
  register: vpcoffer
  check_mode: yes
- name: verify results of vpc offer in check mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed

- name: test create vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
  register: vpcoffer
- name: verify results of vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"
    - vpcoffer.distributed == false
    - vpcoffer.region_level == false

- name: test create vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
  register: vpcoffer
- name: verify results of create vpc offer idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"
    - vpcoffer.distributed == false
    - vpcoffer.region_level == false

- name: test enabling existing vpc offer in check_mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: enabled
  register: vpcoffer
  check_mode: yes
- name: verify results of enabling existing vpc offer in check_mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test enabling existing vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: enabled
  register: vpcoffer
- name: verify results of enabling existing vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test enabling existing vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: enabled
  register: vpcoffer
- name: verify results of enabling existing vpc idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test disabling vpc offer in check_mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
  check_mode: yes
- name: verify results of disabling vpc offer in check_mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test disabling vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
- name: verify results of disabling vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test disabling vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
- name: verify results of disabling vpc idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test rename vpc offer in check_mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description renamed"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
  check_mode: yes
- name: verify results of rename vpc offer in check_mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test rename vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description renamed"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
- name: verify results of rename vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description renamed"

- name: test rename vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description renamed"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: disabled
  register: vpcoffer
- name: verify results of rename vpc offer idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description renamed"

- name: test update offer with minimal params in check_mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description update"
  register: vpcoffer
  check_mode: yes
- name: verify results of update offer with minimal params in check_mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description renamed"

- name: test update offer with minimal params
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description update"
  register: vpcoffer
- name: verify results of update offer with minimal params
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description update"

- name: test update offer with minimal params idempotency
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description update"
  register: vpcoffer
- name: verify results of update offer with minimal params idempotency
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description update"

- name: test remove vpc offer in check_mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: absent
  register: vpcoffer
  check_mode: yes
- name: verify results of rename vpc offer in check_mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Disabled"
    - vpcoffer.display_text == "vpc offering description update"

- name: test remove vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: absent
  register: vpcoffer
- name: verify results of rename vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed

- name: test remove vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: absent
  register: vpcoffer
- name: verify results of rename vpc offer idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed

- name: test create enabled vpc offer in check mode
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: enabled
  register: vpcoffer
  check_mode: yes
- name: verify results of create enabled vpc offer in check mode
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed

- name: test create enabled vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: enabled
  register: vpcoffer
- name: verify results of create enabled vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test create enabled vpc offer idempotence
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: enabled
  register: vpcoffer
- name: verify results of create enabled vpc offer idempotence
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is not changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"

- name: test create enabled region level vpc offer with distrubuted router
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc_drl"
    display_text: "vpc offering description"
    supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ]
    service_providers:
      - { service: 'dns', provider: 'virtualrouter' }
      - { service: 'dhcp', provider: 'virtualrouter' }
    state: enabled
    service_capabilities:
      - {service: 'Connectivity', capabilitytype: 'DistributedRouter', capabilityvalue: true}
      - {service: 'Connectivity', capabilitytype: 'RegionLevelVPC', capabilityvalue: true}
  register: vpcoffer
- name: verify results of create enabled region level vpc offer with distrubuted router
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed
    - vpcoffer.name == "{{ cs_resource_prefix }}_vpc_drl"
    - vpcoffer.state == "Enabled"
    - vpcoffer.display_text == "vpc offering description"
    - vpcoffer.distributed == true
    - vpcoffer.region_level == true

- name: remove vpc offer
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc"
    state: absent
  register: vpcoffer
- name: verify results of remove vpc offer
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed

- name: remove region level vpc offer with distrubuted router
  cs_vpc_offering:
    name: "{{ cs_resource_prefix }}_vpc_drl"
    state: absent
  register: vpcoffer
- name: verify results of remove region level vpc offer with distrubuted router
  assert:
    that:
    - vpcoffer is successful
    - vpcoffer is changed