Update documentation
[integration.git] / test / postman / 05_Onboard_VF.postman_collection.json
1 {
2   "info": {
3     "_postman_id": "8f0c4ff0-c762-4289-8547-daa0def307c1",
4     "name": "05_Onboard_VF",
5     "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
6   },
7   "item": [
8     {
9       "name": "check vf exists and get id",
10       "event": [
11         {
12           "listen": "test",
13           "script": {
14             "id": "a7d64193-edcb-4540-bcac-dde0f33a637f",
15             "exec": [
16               "",
17               "var vf_found = false;",
18               "if (pm.response.code === 404) {",
19               "    tests[pm.environment.get(\"vf_name\")+\" does not exists\"] = true;",
20               "}",
21               "else {",
22               "    if (pm.response.code === 200) {",
23               "        tests[\"Status code is 200\"] = responseCode.code === 200;",
24               "        }",
25               "    var jsonData = pm.response.json();",
26               "    for (var i = 0; i < jsonData.length; i++) { ",
27               "       if (jsonData[i].name === pm.environment.get(\"vf_name\")) {",
28               "           vf_found = true;",
29               "           pm.environment.set(\"auto_vf_uuid\", \"\"+jsonData[i].uuid+\"\");",
30               "           pm.environment.set(\"auto_vf_invariant_uuid\", \"\"+jsonData[i].invariantUUID+\"\");",
31               "       }",
32               "    }",
33               "    if (vf_found === false) {",
34               "        tests[pm.environment.get(\"vf_name\")+\" does not yet exists, we continue the run\"] = true;",
35               "    }",
36               "    ",
37               "    else {",
38               "        tests[pm.environment.get(\"vf_name\")+\" already exists, stop the run\"] = false;",
39               "        postman.setNextRequest(null);",
40               "    }",
41               "}"
42             ],
43             "type": "text/javascript"
44           }
45         }
46       ],
47       "request": {
48         "method": "GET",
49         "header": [
50           {
51             "key": "Content-Type",
52             "value": "application/json"
53           },
54           {
55             "key": "Accept",
56             "value": "application/json"
57           },
58           {
59             "key": "X-TransactionId",
60             "value": "ONAP-Test"
61           },
62           {
63             "key": "USER_ID",
64             "value": "cs0008"
65           },
66           {
67             "key": "X-FromAppId",
68             "value": "ONAP-Test"
69           },
70           {
71             "key": "Authorization",
72             "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU="
73           },
74           {
75             "key": "x-ecomp-instanceid",
76             "value": "ONAP-Test"
77           }
78         ],
79         "body": {
80           "mode": "raw",
81           "raw": ""
82         },
83         "url": {
84           "raw": "{{url-sdc}}/sdc/v1/catalog/resources?resourceType=VF",
85           "host": [
86             "{{url-sdc}}"
87           ],
88           "path": [
89             "sdc",
90             "v1",
91             "catalog",
92             "resources"
93           ],
94           "query": [
95             {
96               "key": "resourceType",
97               "value": "VF"
98             }
99           ]
100         }
101       },
102       "response": []
103     },
104     {
105       "name": "check VSP exists and get infos",
106       "event": [
107         {
108           "listen": "test",
109           "script": {
110             "id": "ff2f00ca-80fc-40d6-b6ec-aac08eb91759",
111             "exec": [
112               "pm.test(\"Status code is 200\", function () {",
113               "    pm.response.to.have.status(200);",
114               "});",
115               "",
116               "var jsonData = pm.response.json();",
117               "var vsp_found = false;",
118               "for (var i = 0; i < jsonData.results.length; i++) { ",
119               "   if (jsonData.results[i].name === pm.environment.get(\"vsp_name\")) {",
120               "       vsp_found = true;",
121               "       pm.environment.set(\"auto_vsp_id\", \"\"+jsonData.results[i].id+\"\");",
122               "",
123               "   }",
124               "}",
125               "if (vsp_found === false) {",
126               "    tests[\"VSP \"+pm.environment.get(\"vsp_name\")+\" does not exists, we stop the run\"] = false;",
127               "    postman.setNextRequest(null);    ",
128               "}",
129               "",
130               "else {",
131               "    tests[\"VSP \"+pm.environment.get(\"vsp_name\")+\" exists, we can continue\"] = true;",
132               "}"
133             ],
134             "type": "text/javascript"
135           }
136         }
137       ],
138       "request": {
139         "method": "GET",
140         "header": [
141           {
142             "key": "Content-Type",
143             "value": "application/json"
144           },
145           {
146             "key": "Accept",
147             "value": "application/json"
148           },
149           {
150             "key": "X-TransactionId",
151             "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a"
152           },
153           {
154             "key": "USER_ID",
155             "value": "cs0008"
156           },
157           {
158             "key": "X-FromAppId",
159             "value": "robot-ete"
160           }
161         ],
162         "body": {
163           "mode": "raw",
164           "raw": ""
165         },
166         "url": {
167           "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products",
168           "host": [
169             "{{url-sdc2}}"
170           ],
171           "path": [
172             "sdc1",
173             "feProxy",
174             "onboarding-api",
175             "v1.0",
176             "vendor-software-products"
177           ]
178         }
179       },
180       "response": []
181     },
182     {
183       "name": "Get VSP versions",
184       "event": [
185         {
186           "listen": "test",
187           "script": {
188             "id": "f16c158f-aceb-490c-924d-3ea83c2b9431",
189             "exec": [
190               "pm.test(\"Status code is 200\", function () {",
191               "    pm.response.to.have.status(200);",
192               "});",
193               "",
194               "var jsonData = pm.response.json();",
195               "var vsp_found = false;",
196               "for (var i = 0; i < jsonData.results.length; i++) { ",
197               "   if (jsonData.results[i].name === pm.environment.get(\"vsp_name\")) {",
198               "       vsp_found = true;",
199               "       pm.environment.set(\"auto_vsp_version_id\", \"\"+jsonData.results[i].id+\"\");",
200               "       pm.environment.set(\"auto_vsp_version_name\", \"\"+jsonData.results[i].name+\"\");",
201               "   }",
202               "}"
203             ],
204             "type": "text/javascript"
205           }
206         }
207       ],
208       "request": {
209         "method": "GET",
210         "header": [
211           {
212             "key": "Content-Type",
213             "value": "application/json"
214           },
215           {
216             "key": "Accept",
217             "value": "application/json"
218           },
219           {
220             "key": "X-TransactionId",
221             "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a"
222           },
223           {
224             "key": "USER_ID",
225             "value": "cs0008"
226           },
227           {
228             "key": "X-FromAppId",
229             "value": "robot-ete"
230           }
231         ],
232         "body": {
233           "mode": "raw",
234           "raw": ""
235         },
236         "url": {
237           "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/items/{{auto_vsp_id}}/versions",
238           "host": [
239             "{{url-sdc2}}"
240           ],
241           "path": [
242             "sdc1",
243             "feProxy",
244             "onboarding-api",
245             "v1.0",
246             "items",
247             "{{auto_vsp_id}}",
248             "versions"
249           ]
250         }
251       },
252       "response": []
253     },
254     {
255       "name": "Get Vendor infos",
256       "event": [
257         {
258           "listen": "test",
259           "script": {
260             "id": "ed512660-e7af-450f-aa7e-b503c7e21a72",
261             "exec": [
262               "pm.test(\"Status code is 200\", function () {",
263               "    pm.response.to.have.status(200);",
264               "});",
265               "",
266               "var jsonData = pm.response.json();",
267               "var vendor_found = false;",
268               "for (var i = 0; i < jsonData.results.length; i++) { ",
269               "   if (jsonData.results[i][\"name\"] === pm.environment.get(\"vendor_name\")) {",
270               "       vendor_found = true;",
271               "       pm.environment.set(\"auto_vendor_id\", \"\"+jsonData.results[i][\"id\"]+\"\");",
272               "   }",
273               "}",
274               "if (vendor_found === false) {",
275               "    tests[pm.environment.get(\"vendor_name\")+\" does not exists : we stop the run\"] = false;",
276               "    postman.setNextRequest(null);",
277               "}",
278               "",
279               "else {",
280               "    tests[pm.environment.get(\"vendor_name\")+\" exists\"] = true;",
281               "}",
282               "",
283               "",
284               ""
285             ],
286             "type": "text/javascript"
287           }
288         }
289       ],
290       "request": {
291         "method": "GET",
292         "header": [
293           {
294             "key": "Content-Type",
295             "value": "application/json"
296           },
297           {
298             "key": "Accept",
299             "value": "application/json"
300           },
301           {
302             "key": "X-TransactionId",
303             "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a"
304           },
305           {
306             "key": "USER_ID",
307             "value": "cs0008"
308           },
309           {
310             "key": "X-FromAppId",
311             "value": "robot-ete"
312           }
313         ],
314         "body": {
315           "mode": "raw",
316           "raw": ""
317         },
318         "url": {
319           "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models",
320           "host": [
321             "{{url-sdc2}}"
322           ],
323           "path": [
324             "sdc1",
325             "feProxy",
326             "onboarding-api",
327             "v1.0",
328             "vendor-license-models"
329           ]
330         }
331       },
332       "response": []
333     },
334     {
335       "name": "Create VF resource",
336       "event": [
337         {
338           "listen": "test",
339           "script": {
340             "id": "78a4913a-db8c-4c41-8fae-28e5bf6d90b4",
341             "exec": [
342               "pm.test(\"Status code is 201\", function () {",
343               "    pm.response.to.have.status(201);",
344               "});",
345               "",
346               "var jsonData = pm.response.json();",
347               "pm.environment.set(\"auto_vf_invariant_uuid\", \"\"+jsonData.invariantUUID+\"\");",
348               "pm.environment.set(\"auto_vf_uuid\", \"\"+jsonData.uuid+\"\");",
349               "pm.environment.set(\"auto_vf_unique_id\", \"\"+jsonData.uniqueId+\"\");",
350               "",
351               "tests[\"VF status is : \"+jsonData.lifecycleState] = jsonData.lifecycleState === \"NOT_CERTIFIED_CHECKOUT\";"
352             ],
353             "type": "text/javascript"
354           }
355         }
356       ],
357       "request": {
358         "method": "POST",
359         "header": [
360           {
361             "key": "Content-Type",
362             "value": "application/json"
363           },
364           {
365             "key": "Accept",
366             "value": "application/json"
367           },
368           {
369             "key": "X-TransactionId",
370             "value": "ONAP-Test"
371           },
372           {
373             "key": "USER_ID",
374             "value": "cs0008"
375           },
376           {
377             "key": "X-FromAppId",
378             "value": "ONAP-Test"
379           },
380           {
381             "key": "Authorization",
382             "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU="
383           },
384           {
385             "key": "x-ecomp-instanceid",
386             "value": "ONAP-Test"
387           }
388         ],
389         "body": {
390           "mode": "raw",
391           "raw": "{\r\n\t\"artifacts\": {},\r\n\t\"toscaArtifacts\": {},\r\n\t\"contactId\": \"cs0008\",\r\n\t\"categories\": [{\r\n\t\t\"name\": \"Generic\",\r\n\t\t\"normalizedName\": \"generic\",\r\n\t\t\"uniqueId\": \"resourceNewCategory.generic\",\r\n\t\t\"icons\": null,\r\n\t\t\"subcategories\": [{\r\n\t\t\t\"name\": \"Abstract\",\r\n\t\t\t\"normalizedName\": \"abstract\",\r\n\t\t\t\"uniqueId\": \"resourceNewCategory.generic.abstract\",\r\n\t\t\t\"icons\": [\"objectStorage\", \"compute\"],\r\n\t\t\t\"groupings\": null,\r\n\t\t\t\"ownerId\": null,\r\n\t\t\t\"empty\": false\r\n\t\t}],\r\n\t\t\"ownerId\": null,\r\n\t\t\"empty\": false\r\n\t}],\r\n\t\"description\": \"VF named {{vf_name}}\",\r\n\t\"icon\": \"defaulticon\",\r\n\t\"componentInstancesProperties\": {},\r\n\t\"componentInstancesAttributes\": {},\r\n\t\"name\": \"{{vf_name}}\",\r\n\t\"tags\": [\"{{vf_name}}\"],\r\n\t\"capabilities\": {},\r\n\t\"requirements\": {},\r\n\t\"deploymentArtifacts\": {},\r\n\t\"componentType\": \"RESOURCE\",\r\n\t\"vendorName\": \"{{vendor_name}}\",\r\n\t\"vendorRelease\": \"1.0\",\r\n\t\"componentInstances\": [],\r\n\t\"properties\": [],\r\n\t\"attributes\": [],\r\n\t\"groups\": [],\r\n\t\"resourceType\": \"VF\",\r\n\t\"csarUUID\": \"{{auto_vsp_id}}\",\r\n\t\"csarVersion\": \"{{auto_vsp_version_name}}\"\r\n}"
392         },
393         "url": {
394           "raw": "{{url-sdc2}}/sdc1/feProxy/rest/v1/catalog/resources",
395           "host": [
396             "{{url-sdc2}}"
397           ],
398           "path": [
399             "sdc1",
400             "feProxy",
401             "rest",
402             "v1",
403             "catalog",
404             "resources"
405           ]
406         }
407       },
408       "response": []
409     },
410     {
411       "name": "Checkin VF resource",
412       "event": [
413         {
414           "listen": "test",
415           "script": {
416             "type": "text/javascript",
417             "exec": [
418               "var jsonData = pm.response.json();",
419               "",
420               "tests[\"VF status is : \"+jsonData.lifecycleState] = jsonData.lifecycleState === \"NOT_CERTIFIED_CHECKIN\";"
421             ]
422           }
423         }
424       ],
425       "request": {
426         "method": "POST",
427         "header": [
428           {
429             "key": "Content-Type",
430             "value": "application/json"
431           },
432           {
433             "key": "Accept",
434             "value": "application/json"
435           },
436           {
437             "key": "X-TransactionId",
438             "value": "ONAP-Test"
439           },
440           {
441             "key": "USER_ID",
442             "value": "cs0008"
443           },
444           {
445             "key": "X-FromAppId",
446             "value": "ONAP-Test"
447           },
448           {
449             "key": "X-ECOMP-InstanceID",
450             "value": "ONAP-Test"
451           },
452           {
453             "key": "Authorization",
454             "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU="
455           }
456         ],
457         "body": {
458           "mode": "raw",
459           "raw": "{\"userRemarks\": \"ONAP-Test checkin\"}"
460         },
461         "url": {
462           "raw": "{{url-sdc}}/sdc/v1/catalog/resources/{{auto_vf_uuid}}/lifecycleState/checkin",
463           "host": [
464             "{{url-sdc}}"
465           ],
466           "path": [
467             "sdc",
468             "v1",
469             "catalog",
470             "resources",
471             "{{auto_vf_uuid}}",
472             "lifecycleState",
473             "checkin"
474           ]
475         }
476       },
477       "response": []
478     },
479     {
480       "name": "Certify VF resource",
481       "event": [
482         {
483           "listen": "test",
484           "script": {
485             "type": "text/javascript",
486             "exec": [
487               "var jsonData = pm.response.json();",
488               "",
489               "tests[\"VF status is : \"+jsonData.lifecycleState] = jsonData.lifecycleState === \"CERTIFIED\";"
490             ]
491           }
492         }
493       ],
494       "request": {
495         "method": "POST",
496         "header": [
497           {
498             "key": "Content-Type",
499             "value": "application/json"
500           },
501           {
502             "key": "Accept",
503             "value": "application/json"
504           },
505           {
506             "key": "X-TransactionId",
507             "value": "ONAP-Test"
508           },
509           {
510             "key": "USER_ID",
511             "value": "cs0008"
512           },
513           {
514             "key": "X-FromAppId",
515             "value": "ONAP-Test"
516           },
517           {
518             "key": "Authorization",
519             "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU="
520           },
521           {
522             "key": "X-ECOMP-InstanceID",
523             "value": "ONAP-Test"
524           }
525         ],
526         "body": {
527           "mode": "raw",
528           "raw": "{\"userRemarks\": \"certify\"}"
529         },
530         "url": {
531           "raw": "{{url-sdc2}}/sdc1/feProxy/rest/v1/catalog/resources/{{auto_vf_unique_id}}/lifecycleState/certify",
532           "host": [
533             "{{url-sdc2}}"
534           ],
535           "path": [
536             "sdc1",
537             "feProxy",
538             "rest",
539             "v1",
540             "catalog",
541             "resources",
542             "{{auto_vf_unique_id}}",
543             "lifecycleState",
544             "certify"
545           ]
546         }
547       },
548       "response": []
549     },
550     {
551       "name": "Get VF infos by uniqueId to get new vf_unique_Id (=new version id)",
552       "event": [
553         {
554           "listen": "test",
555           "script": {
556             "id": "8d831aa8-7760-44b4-aab4-da4724e8dfc9",
557             "exec": [
558               "pm.test(\"Status code is 200\", function () {",
559               "    pm.response.to.have.status(200);",
560               "});",
561               "",
562               "var jsonData = pm.response.json();",
563               "pm.environment.set(\"auto_vf_new_unique_id\", \"\"+jsonData[\"metadata\"][\"allVersions\"][\"1.0\"]+\"\");",
564               ""
565             ],
566             "type": "text/javascript"
567           }
568         }
569       ],
570       "request": {
571         "method": "GET",
572         "header": [
573           {
574             "key": "Content-Type",
575             "value": "application/json"
576           },
577           {
578             "key": "Accept",
579             "value": "application/json"
580           },
581           {
582             "key": "X-TransactionId",
583             "value": "ONAP-Test"
584           },
585           {
586             "key": "USER_ID",
587             "value": "cs0008"
588           },
589           {
590             "key": "X-FromAppId",
591             "value": "ONAP-Test"
592           },
593           {
594             "key": "Authorization",
595             "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU="
596           },
597           {
598             "key": "x-ecomp-instanceid",
599             "value": "ONAP-Test"
600           }
601         ],
602         "body": {
603           "mode": "raw",
604           "raw": ""
605         },
606         "url": {
607           "raw": "{{url-sdc2}}/sdc1/feProxy/rest/v1/catalog/resources/{{auto_vf_unique_id}}/filteredDataByParams?include=metadata",
608           "host": [
609             "{{url-sdc2}}"
610           ],
611           "path": [
612             "sdc1",
613             "feProxy",
614             "rest",
615             "v1",
616             "catalog",
617             "resources",
618             "{{auto_vf_unique_id}}",
619             "filteredDataByParams"
620           ],
621           "query": [
622             {
623               "key": "include",
624               "value": "metadata"
625             }
626           ]
627         }
628       },
629       "response": []
630     }
631   ]
632 }