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