blob: d80bb0257477d14feae5db2ac2f3317e39881ea3 (
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
|
---
- name: setup
cs_volume:
zone: "{{ cs_common_zone_adv }}"
name: "{{ cs_resource_prefix }}_upload"
state: absent
register: uploaded_vol
- name: verify setup
assert:
that:
- uploaded_vol is successful
- name: setup network
cs_network:
name: "cs_volume_network"
zone: "{{ cs_common_zone_adv }}"
network_offering: DefaultSharedNetworkOffering
vlan: 2435
start_ip: 10.100.129.11
end_ip: 10.100.129.250
gateway: 10.100.129.1
netmask: 255.255.255.0
register: net
- name: verify setup network
assert:
that:
- net is successful
- net.name == "cs_volume_network"
- name: setup instance
cs_instance:
zone: "{{ cs_common_zone_adv }}"
name: "{{ test_cs_instance_3 }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
network: cs_volume_network
register: instance
- name: verify setup instance
assert:
that:
- instance is successful
- name: setup stop instance
cs_instance:
zone: "{{ cs_common_zone_adv }}"
name: "{{ test_cs_instance_3 }}"
state: stopped
register: instance
- name: verify stop instance
assert:
that:
- instance is successful
- instance.state == 'Stopped'
- name: setup get instance facts
cs_instance_facts:
name: "{{ test_cs_instance_3 }}"
register: instance
- name: verify setup get instance facts
assert:
that:
- instance is successful
- name: test extract volume in check mode
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: extracted
name: "{{ instance.volumes[0].name }}"
check_mode: yes
register: extracted_vol
- name: verify test extract volume in check mode
assert:
that:
- extracted_vol is successful
- extracted_vol is changed
- extracted_vol.state == "Ready"
- extracted_vol.name == "{{ instance.volumes[0].name }}"
- extracted_vol.url is not defined
- name: test extract volume
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: extracted
name: "{{ instance.volumes[0].name }}"
register: extracted_vol
- name: verify test extract volume
assert:
that:
- extracted_vol is successful
- extracted_vol is changed
- extracted_vol.state == "DOWNLOAD_URL_CREATED"
- extracted_vol.name == "{{ instance.volumes[0].name }}"
- extracted_vol.url is defined
- name: test upload volume with missing param
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: uploaded
name: "{{ cs_resource_prefix }}_upload"
url: "{{ test_cs_volume_to_upload }}"
ignore_errors: yes
register: uploaded_vol
- name: verify upload volume with missing param
assert:
that:
- uploaded_vol is failed
- uploaded_vol is not changed
- 'uploaded_vol.msg == "state is uploaded but all of the following are missing: format"'
- name: test upload volume in check mode
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: uploaded
name: "{{ cs_resource_prefix }}_upload"
format: VHD
url: "{{ test_cs_volume_to_upload }}"
check_mode: yes
register: uploaded_vol
- name: verify upload volume in check mode
assert:
that:
- uploaded_vol is successful
- uploaded_vol is changed
- uploaded_vol.name is not defined
- name: test upload volume
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: uploaded
name: "{{ cs_resource_prefix }}_upload"
format: VHD
url: "{{ test_cs_volume_to_upload }}"
register: uploaded_vol
- name: verify upload volume
assert:
that:
- uploaded_vol is successful
- uploaded_vol is changed
- uploaded_vol.name == "{{ cs_resource_prefix }}_upload"
- uploaded_vol.state == "Uploaded"
- name: test upload volume idempotence
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: uploaded
name: "{{ cs_resource_prefix }}_upload"
format: VHD
url: "{{ test_cs_volume_to_upload }}"
register: uploaded_vol
- name: verify upload volume idempotence
assert:
that:
- uploaded_vol is successful
- uploaded_vol is not changed
- uploaded_vol.name == "{{ cs_resource_prefix }}_upload"
- uploaded_vol.state == "Uploaded"
- name: delete volume
cs_volume:
zone: "{{ cs_common_zone_adv }}"
state: absent
name: "{{ cs_resource_prefix }}_upload"
register: uploaded_vol
- name: verify delete volume
assert:
that:
- uploaded_vol is successful
- uploaded_vol is changed
- name: destroy instance
cs_instance:
zone: "{{ cs_common_zone_adv }}"
name: "{{ test_cs_instance_3 }}"
state: expunged
register: instance
- name: verify destroy instance
assert:
that:
- instance is successful
- name: delete network
cs_network:
name: "cs_volume_network"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: net
- name: verify delete network
assert:
that:
- net is successful
|