-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.robot
424 lines (393 loc) · 21.2 KB
/
production.robot
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
*** Settings ***
Library RequestsLibrary
Library Zoomba.APILibrary
Variables ../APITests.py
Resource ../Variables/globalvariables.robot
Resource ../Variables/production_variables.robot
Resource ../Resources/Mobileum.robot
Library JSONLibrary
Library Collections
*** Variables ***
${account_id}
${tenant_id}
${owner_tenant_id}
${gateway_id}
*** Keywords ***
Configure New Token for Production environment
${auth}= Evaluate (${client_id}, ${client_secret},)
RequestsLibrary.Create Session baseUri ${base_url} verify=True auth=${auth}
&{params}= Create Dictionary grant_type=${grant_type}
&{headers}= Create Dictionary Accept= ${accept}, Content-Type= ${www-form}, Authorization= ${user} ${pass}
${resp}= RequestsLibrary.POST On Session baseUri ${token} ${params} ${headers}
log ${resp}
${type string}= Evaluate type($resp)
Log To Console ${type string}
log ${resp.json()['access_token']}
${accessToken}= evaluate $resp.json().get("access_token")
log ${accessToken}
RequestsLibrary.Status Should Be 200 ${resp}
[Return] ${accessToken}
Get SREQA Tenant ID for Production Environment
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Owner-Id}= GET Owner Tenant ID for Production Environment
log ${X-Asavie-Owner-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept} X-Asavie-Owner-Id=${X-Asavie-Owner-Id} X-Asavie-Tenant-Id=${X-Asavie-Owner-Id}
${response}= call get request ${headers2} ${base_url} ${stage_summary}
log ${response}
Should Be True ${response.status_code} == 200
${account_id} get value from json ${response.json()} $.items[0].id
log ${account_id}
${length}= get length ${response.json()}
log ${length}
Set Suite Variable ${success_num} ${0}
FOR ${item} IN RANGE ${success_num} ${length}
${acc_id} get value from json ${response.json()} $.[${success_num}].id
log ${acc_id}
${acc_name} get value from json ${response.json()} $.[${success_num}].name
log ${acc_name}
${acc_name_str}= Evaluate "".join(${acc_name})
log ${acc_name_str}
${var}= set variable if '${acc_name_str}' == '${SREQA}' ${acc_id}
exit for loop if '${acc_name_str}' == '${SREQA}'
${success_num}= Evaluate ${success_num} + 1
log ${success_num}
END
${convertListToString}= Evaluate "".join(${var})
log ${convertListToString}
[Return] ${convertListToString}
GET Owner Tenant ID for Production Environment
${token}= Configure New Token for Production environment
log ${token}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept}
IF "${owner_tenant_id}" == ""
${response}= call get request ${headers2} ${base_url} ${stage_url_owner_tenant}
log ${response}
Should Be True ${response.status_code} == 200
${tenant_id} get value from json ${response.json()} id
log ${tenant_id}
Set Suite Variable ${tenant_id}
END
${convertListToString}= Evaluate "".join(${tenant_id})
log ${convertListToString}
[Return] ${convertListToString}
Get Automation Account ID for Production Environment
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Owner-Id}= GET Owner Tenant ID for Production Environment
log ${X-Asavie-Owner-Id}
${X-Asavie-Tenant-Id}= Get SREQA Tenant ID for Production Environment
log ${X-Asavie-Tenant-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept} X-Asavie-Owner-Id=${X-Asavie-Owner-Id} X-Asavie-Tenant-Id=${X-Asavie-Tenant-Id}
${response}= call get request ${headers2} ${base_url} ${stage_summary}
log ${response}
Should Be True ${response.status_code} == 200
${account_id} get value from json ${response.json()} $.items[0].id
log ${account_id}
${length}= get length ${response.json()}
log ${length}
Set Suite Variable ${success_num} ${0}
FOR ${item} IN RANGE ${success_num} ${length}
${acc_id} get value from json ${response.json()} $.[${success_num}].id
log ${acc_id}
${acc_name} get value from json ${response.json()} $.[${success_num}].name
log ${acc_name}
${acc_name_str}= Evaluate "".join(${acc_name})
log ${acc_name_str}
${var}= set variable if '${acc_name_str}' == '${Automation}' ${acc_id}
exit for loop if '${acc_name_str}' == '${Automation}'
${success_num}= Evaluate ${success_num} + 1
log ${success_num}
END
${convertListToString}= Evaluate "".join(${var})
log ${convertListToString}
[Return] ${convertListToString}
Get Account ID Inside Automation
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Owner-Id}= GET Owner Tenant ID for Production Environment
log ${X-Asavie-Owner-Id}
${X-Asavie-Tenant-Id}= Get Automation Account ID for Production Environment
log ${X-Asavie-Tenant-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept} X-Asavie-Owner-Id=${X-Asavie-Owner-Id} X-Asavie-Tenant-Id=${X-Asavie-Tenant-Id}
${response}= call get request ${headers2} ${base_url} ${stage_url_accounts}
log ${response}
Should Be True ${response.status_code} == 200
${length}= get length ${response.json()["items"]}
log ${length}
Set Suite Variable ${success_num} ${0}
FOR ${item} IN RANGE ${success_num} ${length}
${acc_id} get value from json ${response.json()} $.items[${success_num}].id
log ${acc_id}
${acc_name} get value from json ${response.json()} $.items[${success_num}].name
log ${acc_name}
${acc_name_str}= Evaluate "".join(${acc_name})
log ${acc_name_str}
${var}= set variable if '${acc_name_str}' == '${AT&T}' ${acc_id}
exit for loop if '${acc_name_str}' == '${AT&T}'
${success_num}= Evaluate ${success_num} + 1
log ${success_num}
END
${convertListToString}= Evaluate "".join(${var})
log ${convertListToString}
[Return] ${convertListToString}
Create IPSec gateway with 1 Port and 1 Link Linode
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
IF "${gateway_id}" == ""
${response}= call post request ${headers2} ${base_url} ${ipsec_gateways} ${IPsec_gateway_1port_linode}
log ${response}
Should Be True ${response.status_code} == 201
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
Set Suite Variable ${gateway_id}
END
[Return] ${gateway_id}
Create IPSec gateway with 2 Port and 2 Link Linode Automation
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
IF "${gateway_id}" == ""
${response}= call post request ${headers2} ${base_url} ${ipsec_gateways} ${IPsec_gateway_2port_2links_Linode}
log ${response}
Should Be True ${response.status_code} == 201
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
Set Suite Variable ${gateway_id}
END
[Return] ${gateway_id}
Create IPSec gateway with 1 Port and 1 Link Linode Automation
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
IF "${gateway_id}" == ""
${response}= call post request ${headers2} ${base_url} ${ipsec_gateways} ${IPsec_gateway_1port_1link_ATT_Jasper}
log ${response}
Should Be True ${response.status_code} == 201
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
Set Suite Variable ${gateway_id}
END
[Return] ${gateway_id}
Get All IPSEC gateways and fetch newly created GatewayID Automation
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call get request ${headers2} ${base_url} ${ipsec_gateways}
log ${response}
Should Be True ${response.status_code} == 200
${length}= get length ${response.json()["items"]}
log ${length}
set suite variable ${success_num} ${0}
FOR ${item} IN RANGE ${success_num} ${length}
${acc_id} get value from json ${response.json()} $.items[${success_num}].id
log ${acc_id}
${acc_name} get value from json ${response.json()} $.items[${success_num}].name
log ${acc_name}
${acc_name_str}= Evaluate "".join(${acc_name})
log ${acc_name_str}
${var}= set variable if '${acc_name_str}' == '${automation_name}' ${acc_id}
exit for loop if '${acc_name_str}' == '${automation_name}'
${success_num}= Evaluate ${success_num} + 1
log ${success_num}
END
${convertListToString}= Evaluate "".join(${var})
log ${convertListToString}
[Return] ${convertListToString}
Get Link Status of gateway for Automation Gateway
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${gateway_patch}= set variable ${ipsec_gateways}/${new_gateway_id}
log ${gateway_patch}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call get request ${headers2} ${base_url} ${gateway_patch}
log ${response}
Should Be True ${response.status_code} == 200
${gateway_status} get value from json ${response.json()} $.status
log ${gateway_status}
${gateway_message} get value from json ${response.json()} $.status_description.message
log ${gateway_message}
${gateway_status_description}= Evaluate "".join(${gateway_message})
log ${gateway_status_description}
${status_gateway}= Evaluate "".join(${gateway_status})
log ${status_gateway}
[Return] ${status_gateway}
Patch Ipsec Gateways for AT&T Japser Linode
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${gateway_patch}= set variable ${ipsec_gateways}/${new_gateway_id}
log ${gateway_patch}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call patch request ${headers2} ${base_url} ${gateway_patch} ${update_ipsec_gateway}
log ${response}
Should Be True ${response.status_code} == 200
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
Check Disable status of Gateway
${status_gateway}= Get Link Status of gateway for Automation Gateway
should be equal ${status_gateway} ${disable} msg=Status of Ipsec coming wrong.Possibility of bug.
Check offline Status after enabling the Gateway
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
wait until keyword succeeds 5min 30s Check offline status
Check offline status
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
should be equal ${status_gateway} ${offline} msg=Status of Ipsec coming wrong.Possibility of bug.
Check enabled Status after enabling the Gateway
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
wait until keyword succeeds 5min 30s Check enabled status
Check enabled status
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
should be equal ${status_gateway} ${enable} msg=Status of Ipsec coming wrong.Possibility of bug.
Disable Ipsec Gateway
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${gateway_patch}= set variable ${ipsec_gateways}/${new_gateway_id}
log ${gateway_patch}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call patch request ${headers2} ${base_url} ${gateway_patch} ${disable_ipsec_gateway}
log ${response}
Should Be True ${response.status_code} == 200
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
Check disabled Status after disabling the Gateway
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
wait until keyword succeeds 5min 30s Check disabled status
Check disabled status
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
should be equal ${status_gateway} ${disable} msg=Status of Ipsec coming wrong.Possibility of bug.
Delete Ipsec Gateway
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${gateway_patch}= set variable ${ipsec_gateways}/${new_gateway_id}
log ${gateway_patch}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call delete request ${headers2} ${base_url} ${gateway_patch}
log ${response}
Should Be True ${response.status_code} == 200
Attach to Default Network
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-owner-Id}= GET Owner Tenant ID for Production Environment
log ${X-Asavie-owner-Id}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${gateway_attach_network}= set variable ${ipsec_gateways}/${new_gateway_id}/attachments
log ${gateway_attach_network}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept_format} Content-Type=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id} X-Asavie-Owner-Id=${X-Asavie-owner-Id}
${response}= call post request ${headers2} ${base_url} ${gateway_attach_network} ${attach_production_network}
log ${response}
Should Be True ${response.status_code} == 201
${gateway_id} get value from json ${response.json()} id
log ${gateway_id}
sleep 20s
Check Online Status after enabling the Gateway
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
wait until keyword succeeds 5min 30s Check online status
Check online status
${status_gateway}= Get Link Status of gateway for Automation Gateway
log ${status_gateway}
should be equal ${status_gateway} ${online} msg=Status of Ipsec coming wrong.Possibility of bug.
Delete Gateway Attachment Automation
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${new_gateway_id}= Get All IPSEC gateways and fetch newly created GatewayID Automation
log ${new_gateway_id}
${attachment_id}= Get Attachment ID for newly created Gateway
log ${attachment_id}
${delete_attach}= set variable ${ipsec_gateways}/${new_gateway_id}/attachments/${attachment_id}
log ${delete_attach}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${aster} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call delete request ${headers2} ${base_url} ${delete_attach}
log ${response}
Should Be True ${response.status_code} == 202
Get Attachment ID for newly created Gateway
${token}= Configure New Token for Production environment
log ${token}
${X-Asavie-Account-Id}= Get Account ID Inside Automation
log ${X-Asavie-Account-Id}
${token1}= Set Variable Bearer ${token}
set global variable &{headers2} Authorization=${token1} Accept=${accept} X-Asavie-Account-Id=${X-Asavie-Account-Id}
${response}= call get request ${headers2} ${base_url} ${ipsec_gateways}
log ${response}
Should Be True ${response.status_code} == 200
${length}= get length ${response.json()["items"]}
log ${length}
Set Suite Variable ${success_num} ${0}
FOR ${item} IN RANGE ${success_num} ${length}
${acc_id} get value from json ${response.json()} $.items[${success_num}].attachments[${success_num}].id
log ${acc_id}
${acc_name} get value from json ${response.json()} $.items[${success_num}].name
log ${acc_name}
${acc_name_str}= Evaluate "".join(${acc_name})
log ${acc_name_str}
${var}= set variable if '${acc_name_str}' == '${automation_name}' ${acc_id}
exit for loop if '${acc_name_str}' == '${automation_name}'
${success_num}= Evaluate ${success_num} + 1
log ${success_num}
END
${convertListToString}= Evaluate "".join(${var})
log ${convertListToString}
[Return] ${convertListToString}
Create initial Gateway setup for Automation
Suppress Insecure Request Warnings
Create IPSec gateway with 1 Port and 1 Link Linode Automation
Get All IPSEC gateways and fetch newly created GatewayID Automation
Check Disable status of Gateway
Patch Ipsec Gateways for AT&T Japser Linode
Check online Status after enabling the Gateway
Attach to Default Network
Tear down initial Gateway Setup for Automation
Delete Gateway Attachment Automation
Disable Ipsec Gateway
Check disabled Status after disabling the Gateway
Delete Ipsec Gateway