summaryrefslogtreecommitdiff
path: root/test/integration/targets/cs_network_acl/tasks/main.yml
blob: 5b39ac379b6218e7dc295393fc80fda83132b4b4 (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
---
- name: setup vpc
  cs_vpc:
    name: "{{ cs_resource_prefix }}_vpc"
    display_text: "{{ cs_resource_prefix }}_display_text"
    cidr: 10.10.0.0/16
    zone: "{{ cs_common_zone_adv }}"
  register: vpc
- name: verify setup vpc
  assert:
    that:
    - vpc|success

- name: setup network acl absent
  cs_network_acl:
    name: "{{ cs_resource_prefix }}_acl"
    vpc: "{{ cs_resource_prefix }}_vpc"
    zone: "{{ cs_common_zone_adv }}"
    state: absent
  register: acl
- name: verify setup network acl absent
  assert:
    that:
    - acl|success

- name: test fail missing param name and vpc for network acl
  cs_network_acl:
  ignore_errors: true
  register: acl
- name: verify test fail missing param name and vpc for network acl
  assert:
    that:
    - acl|failed
    - "acl.msg.startswith('missing required arguments: ')"

- name: test create network acl
  cs_network_acl:
    name: "{{ cs_resource_prefix }}_acl"
    vpc: "{{ cs_resource_prefix }}_vpc"
    zone: "{{ cs_common_zone_adv }}"
  register: acl
- name: verify test create network acl
  assert:
    that:
    - acl|success
    - acl|changed
    - acl.vpc == "{{ cs_resource_prefix }}_vpc"
    - acl.name == "{{ cs_resource_prefix }}_acl"

- name: test create network acl idempotence
  cs_network_acl:
    name: "{{ cs_resource_prefix }}_acl"
    vpc: "{{ cs_resource_prefix }}_vpc"
    zone: "{{ cs_common_zone_adv }}"
  register: acl
- name: verify test create network acl idempotence
  assert:
    that:
    - acl|success
    - not acl|changed
    - acl.vpc == "{{ cs_resource_prefix }}_vpc"
    - acl.name == "{{ cs_resource_prefix }}_acl"

- name: test remove network acl
  cs_network_acl:
    name: "{{ cs_resource_prefix }}_acl"
    vpc: "{{ cs_resource_prefix }}_vpc"
    zone: "{{ cs_common_zone_adv }}"
    state: absent
  register: acl
- name: verify test remove network acl
  assert:
    that:
    - acl|success
    - acl|changed
    - acl.vpc == "{{ cs_resource_prefix }}_vpc"
    - acl.name == "{{ cs_resource_prefix }}_acl"

- name: test remove network acl idempotence
  cs_network_acl:
    name: "{{ cs_resource_prefix }}_acl"
    vpc: "{{ cs_resource_prefix }}_vpc"
    zone: "{{ cs_common_zone_adv }}"
    state: absent
  register: acl
- name: verify test remove network acl idempotence
  assert:
    that:
    - acl|success
    - not acl|changed