Correct minor issues in onap deployment scripts
[integration.git] / test / postman / 10_Service_Order.postman_collection.json
1 {
2         "variables": [],
3         "info": {
4                 "name": "10_Service_Order",
5                 "_postman_id": "28bdf2bb-4886-b8e7-45e3-eac832efc757",
6                 "description": "",
7                 "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
8         },
9         "item": [
10                 {
11                         "name": "GET ExternalAPI-NBI component Status (HealthCheck)",
12                         "event": [
13                                 {
14                                         "listen": "test",
15                                         "script": {
16                                                 "type": "text/javascript",
17                                                 "exec": [
18                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
19                                                         "",
20                                                         "",
21                                                         "var jsonData = JSON.parse(responseBody);",
22                                                         "tests[\"status\"] = jsonData.status === \"ok\";"
23                                                 ]
24                                         }
25                                 }
26                         ],
27                         "request": {
28                                 "url": "{{url-nbi}}/status",
29                                 "method": "GET",
30                                 "header": [],
31                                 "body": {},
32                                 "description": ""
33                         },
34                         "response": []
35                 },
36                 {
37                         "name": "GET all service models from Service Catalog API",
38                         "event": [
39                                 {
40                                         "listen": "test",
41                                         "script": {
42                                                 "type": "text/javascript",
43                                                 "exec": [
44                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
45                                                         "",
46                                                         "var jsonData = JSON.parse(responseBody);",
47                                                         "var service_found = false;",
48                                                         "for (var i = 0; i < jsonData.length; i++) { ",
49                                                         "   if (jsonData[i].name === postman.getGlobalVariable(\"service\")) {",
50                                                         "       service_found = true;",
51                                                         "       postman.setGlobalVariable(\"auto_service_id\", \"\"+jsonData[i].id+\"\");",
52                                                         "   }",
53                                                         "}",
54                                                         "tests[postman.getGlobalVariable(\"service\")+\" exists\"] = service_found === true;",
55                                                         ""
56                                                 ]
57                                         }
58                                 }
59                         ],
60                         "request": {
61                                 "url": "{{url-nbi}}/serviceSpecification",
62                                 "method": "GET",
63                                 "header": [],
64                                 "body": {},
65                                 "description": ""
66                         },
67                         "response": []
68                 },
69                 {
70                         "name": "GET all service instances via ServiceInventory API",
71                         "event": [
72                                 {
73                                         "listen": "test",
74                                         "script": {
75                                                 "type": "text/javascript",
76                                                 "exec": [
77                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
78                                                         "",
79                                                         "var jsonData = JSON.parse(responseBody);",
80                                                         "var service_instance_found = false;",
81                                                         "for (var i = 0; i < jsonData.length; i++) { ",
82                                                         "   if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {",
83                                                         "       service_instance_found = true;",
84                                                         "   }",
85                                                         "}",
86                                                         "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;"
87                                                 ]
88                                         }
89                                 }
90                         ],
91                         "request": {
92                                 "url": {
93                                         "raw": "{{url-nbi}}/service?relatedParty.id={{customer_name}}",
94                                         "host": [
95                                                 "{{url-nbi}}"
96                                         ],
97                                         "path": [
98                                                 "nbi",
99                                                 "api",
100                                                 "v3",
101                                                 "service"
102                                         ],
103                                         "query": [
104                                                 {
105                                                         "key": "relatedParty.id",
106                                                         "value": "{{customer_name}}",
107                                                         "equals": true,
108                                                         "description": ""
109                                                 }
110                                         ],
111                                         "variable": []
112                                 },
113                                 "method": "GET",
114                                 "header": [],
115                                 "body": {},
116                                 "description": ""
117                         },
118                         "response": []
119                 },
120                 {
121                         "name": "Add service instance via ServiceOrder API",
122                         "event": [
123                                 {
124                                         "listen": "test",
125                                         "script": {
126                                                 "type": "text/javascript",
127                                                 "exec": [
128                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;",
129                                                         "",
130                                                         "var jsonData = JSON.parse(responseBody);",
131                                                         "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");",
132                                                         "",
133                                                         "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);",
134                                                         "    "
135                                                 ]
136                                         }
137                                 }
138                         ],
139                         "request": {
140                                 "url": "{{url-nbi}}/serviceOrder",
141                                 "method": "POST",
142                                 "header": [
143                                         {
144                                                 "key": "Accept",
145                                                 "value": "application/json",
146                                                 "description": ""
147                                         },
148                                         {
149                                                 "key": "Content-Type",
150                                                 "value": "application/json",
151                                                 "description": ""
152                                         }
153                                 ],
154                                 "body": {
155                                         "mode": "raw",
156                                         "raw": "{\n  \"externalId\": \"{{externalId}}\",\n  \"priority\": \"1\",\n  \"description\": \"{{service}} order for generic customer via Postman\",\n  \"category\": \"Consumer\",\n  \"requestedStartDate\": \"2018-04-26T08:33:37.299Z\",\n  \"requestedCompletionDate\": \"2018-04-26T08:33:37.299Z\",\n  \"relatedParty\": [\n    {\n      \"id\": \"{{customer_name}}\",\n      \"role\": \"ONAPcustomer\",\n      \"name\": \"{{customer_name}}\"\n    }\n  ],\n  \"orderItem\": [\n    {\n      \"id\": \"1\",\n      \"action\": \"add\",\n      \"service\": {\n        \"name\": \"{{service_instance_name}}\",\n        \"serviceState\": \"active\",\n        \"serviceSpecification\": {\n          \"id\": \"{{auto_service_id}}\"\n        }\n      }\n    }\n  ]\n}"
157                                 },
158                                 "description": ""
159                         },
160                         "response": []
161                 },
162                 {
163                         "name": "GET previous serviceOrder",
164                         "event": [
165                                 {
166                                         "listen": "test",
167                                         "script": {
168                                                 "type": "text/javascript",
169                                                 "exec": [
170                                                         "",
171                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
172                                                         "",
173                                                         "var jsonData = JSON.parse(responseBody);",
174                                                         "",
175                                                         "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");",
176                                                         "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");",
177                                                         "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";",
178                                                         "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";",
179                                                         "",
180                                                         "if(jsonData.hasOwnProperty('orderItem.service.id')){",
181                                                         "    postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem.service.id+\"\");",
182                                                         "}",
183                                                         "postman.setGlobalVariable(\"auto_service_messageInformation\", \"\"+jsonData.orderMessage[0].messageInformation+\"\");",
184                                                         ""
185                                                 ]
186                                         }
187                                 }
188                         ],
189                         "request": {
190                                 "url": "{{url-nbi}}/serviceOrder/{{auto_service_order_id}}",
191                                 "method": "GET",
192                                 "header": [
193                                         {
194                                                 "key": "Accept",
195                                                 "value": "application/json",
196                                                 "description": ""
197                                         },
198                                         {
199                                                 "key": "Content-Type",
200                                                 "value": "application/json",
201                                                 "description": ""
202                                         }
203                                 ],
204                                 "body": {
205                                         "mode": "raw",
206                                         "raw": "{\n  \"externalId\": \"NBI-SO002\",\n  \"priority\": \"1\",\n  \"description\": \"Firevall service ordering on customer not specified - added to generic customer\",\n  \"category\": \"Consumer\",\n  \"requestedStartDate\": \"2018-02-28T13:33:37.299Z\",\n  \"requestedCompletionDate\": \"2018-02-28T13:33:37.299Z\",\n  \"orderItem\": [\n    {\n      \"id\": \"1\",\n      \"action\": \"add\",\n      \"service\": {\n        \"id\": \"vFW0002\",\n        \"serviceState\": \"active\",\n        \"serviceSpecification\": {\n          \"id\": \"ff3c8594-499e-445c-8d14-758231f47799\"\n        }\n      }\n    }\n  ]\n}"
207                                 },
208                                 "description": ""
209                         },
210                         "response": []
211                 },
212                 {
213                         "name": "GET created service instance in inventory",
214                         "event": [
215                                 {
216                                         "listen": "test",
217                                         "script": {
218                                                 "type": "text/javascript",
219                                                 "exec": [
220                                                         "",
221                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
222                                                         "",
223                                                         "",
224                                                         ""
225                                                 ]
226                                         }
227                                 }
228                         ],
229                         "request": {
230                                 "url": "{{url-nbi}}/service/{{auto_service_instance_id}}",
231                                 "method": "GET",
232                                 "header": [],
233                                 "body": {},
234                                 "description": ""
235                         },
236                         "response": []
237                 },
238                 {
239                         "name": "Delete service Instance via ServiceOrder API",
240                         "event": [
241                                 {
242                                         "listen": "test",
243                                         "script": {
244                                                 "type": "text/javascript",
245                                                 "exec": [
246                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;",
247                                                         "",
248                                                         "var jsonData = JSON.parse(responseBody);",
249                                                         "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);",
250                                                         "",
251                                                         "",
252                                                         "",
253                                                         ""
254                                                 ]
255                                         }
256                                 }
257                         ],
258                         "request": {
259                                 "url": "{{url-nbi}}/serviceOrder",
260                                 "method": "POST",
261                                 "header": [
262                                         {
263                                                 "key": "Accept",
264                                                 "value": "application/json",
265                                                 "description": ""
266                                         },
267                                         {
268                                                 "key": "Content-Type",
269                                                 "value": "application/json",
270                                                 "description": ""
271                                         }
272                                 ],
273                                 "body": {
274                                         "mode": "raw",
275                                         "raw": "{\n  \"externalId\": \"{{externalId}}\",\n  \"priority\": \"1\",\n  \"description\": \"{{service}} ordering on generic customer via Postman\",\n  \"category\": \"Consumer\",\n  \"requestedStartDate\": \"2018-04-26T08:33:37.299Z\",\n  \"requestedCompletionDate\": \"2018-04-26T08:33:37.299Z\",\n  \"relatedParty\": [\n    {\n      \"id\": \"{{customer_name}}\",\n      \"role\": \"ONAPcustomer\",\n      \"name\": \"{{customer_name}}\"\n    }\n  ],\n  \"orderItem\": [\n    {\n      \"id\": \"1\",\n      \"action\": \"delete\",\n      \"service\": {\n        \"id\": \"{{auto_service_instance_id}}\",\n        \"serviceState\": \"active\",\n        \"serviceSpecification\": {\n          \"id\": \"{{auto_service_id}}\"\n        }\n      }\n    }\n  ]\n}"
276                                 },
277                                 "description": ""
278                         },
279                         "response": []
280                 },
281                 {
282                         "name": "DELAY 10s",
283                         "request": {
284                                 "url": "https://postman-echo.com/delay/10",
285                                 "method": "GET",
286                                 "header": [],
287                                 "body": {
288                                         "mode": "raw",
289                                         "raw": ""
290                                 },
291                                 "description": ""
292                         },
293                         "response": []
294                 },
295                 {
296                         "name": "GET previous serviceOrder",
297                         "event": [
298                                 {
299                                         "listen": "test",
300                                         "script": {
301                                                 "type": "text/javascript",
302                                                 "exec": [
303                                                         "",
304                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
305                                                         "",
306                                                         "var jsonData = JSON.parse(responseBody);",
307                                                         "",
308                                                         "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");",
309                                                         "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");",
310                                                         "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";",
311                                                         "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";",
312                                                         "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");",
313                                                         ""
314                                                 ]
315                                         }
316                                 }
317                         ],
318                         "request": {
319                                 "url": "{{url-nbi}}/serviceOrder/{{auto_service_order_id}}",
320                                 "method": "GET",
321                                 "header": [
322                                         {
323                                                 "key": "Accept",
324                                                 "value": "application/json",
325                                                 "description": ""
326                                         },
327                                         {
328                                                 "key": "Content-Type",
329                                                 "value": "application/json",
330                                                 "description": ""
331                                         }
332                                 ],
333                                 "body": {
334                                         "mode": "raw",
335                                         "raw": "{\n  \"externalId\": \"NBI-SO002\",\n  \"priority\": \"1\",\n  \"description\": \"Firevall service ordering on customer not specified - added to generic customer\",\n  \"category\": \"Consumer\",\n  \"requestedStartDate\": \"2018-02-28T13:33:37.299Z\",\n  \"requestedCompletionDate\": \"2018-02-28T13:33:37.299Z\",\n  \"orderItem\": [\n    {\n      \"id\": \"1\",\n      \"action\": \"add\",\n      \"service\": {\n        \"id\": \"vFW0002\",\n        \"serviceState\": \"active\",\n        \"serviceSpecification\": {\n          \"id\": \"ff3c8594-499e-445c-8d14-758231f47799\"\n        }\n      }\n    }\n  ]\n}"
336                                 },
337                                 "description": ""
338                         },
339                         "response": []
340                 },
341                 {
342                         "name": "GET service instance in inventory (should no longer exists)",
343                         "event": [
344                                 {
345                                         "listen": "test",
346                                         "script": {
347                                                 "type": "text/javascript",
348                                                 "exec": [
349                                                         "",
350                                                         "tests[\"Status code is 404\"] = responseCode.code === 404;",
351                                                         "",
352                                                         "",
353                                                         ""
354                                                 ]
355                                         }
356                                 }
357                         ],
358                         "request": {
359                                 "url": "{{url-nbi}}/service/{{auto_service_instance_id}}",
360                                 "method": "GET",
361                                 "header": [],
362                                 "body": {},
363                                 "description": ""
364                         },
365                         "response": []
366                 },
367                 {
368                         "name": "GET all service instance via ServiceInventory API",
369                         "event": [
370                                 {
371                                         "listen": "test",
372                                         "script": {
373                                                 "type": "text/javascript",
374                                                 "exec": [
375                                                         "",
376                                                         "",
377                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
378                                                         "",
379                                                         "var jsonData = JSON.parse(responseBody);",
380                                                         "var service_instance_found = false;",
381                                                         "for (var i = 0; i < jsonData.length; i++) { ",
382                                                         "   if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {",
383                                                         "       service_instance_found = true;",
384                                                         "   }",
385                                                         "}",
386                                                         "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;"
387                                                 ]
388                                         }
389                                 }
390                         ],
391                         "request": {
392                                 "url": {
393                                         "raw": "{{url-nbi}}/service?relatedParty.id={{customer_name}}",
394                                         "host": [
395                                                 "{{url-nbi}}"
396                                         ],
397                                         "path": [
398                                                 "nbi",
399                                                 "api",
400                                                 "v3",
401                                                 "service"
402                                         ],
403                                         "query": [
404                                                 {
405                                                         "key": "relatedParty.id",
406                                                         "value": "{{customer_name}}",
407                                                         "equals": true,
408                                                         "description": ""
409                                                 }
410                                         ],
411                                         "variable": []
412                                 },
413                                 "method": "GET",
414                                 "header": [],
415                                 "body": {},
416                                 "description": ""
417                         },
418                         "response": []
419                 },
420                 {
421                         "name": "GET hubs",
422                         "event": [
423                                 {
424                                         "listen": "test",
425                                         "script": {
426                                                 "type": "text/javascript",
427                                                 "exec": [
428                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
429                                                         ""
430                                                 ]
431                                         }
432                                 }
433                         ],
434                         "request": {
435                                 "url": "{{url-nbi}}/hub",
436                                 "method": "GET",
437                                 "header": [],
438                                 "body": {},
439                                 "description": ""
440                         },
441                         "response": []
442                 }
443         ]
444 }