Rene Robert | 53ef77f | 2019-01-24 18:24:55 +0100 | [diff] [blame] | 1 | { |
| 2 | "variables": [], |
| 3 | "info": { |
Rene Robert | 6edc789 | 2019-01-25 15:36:40 +0100 | [diff] [blame] | 4 | "name": "10_Service_Order", |
Rene Robert | 53ef77f | 2019-01-24 18:24:55 +0100 | [diff] [blame] | 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}}/nbi/api/v3/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}}/nbi/api/v3/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}}/nbi/api/v3/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}}/nbi/api/v3/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\";", |
Rene Robert | 62163be | 2019-02-01 22:00:57 +0100 | [diff] [blame] | 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+\"\");", |
Rene Robert | 53ef77f | 2019-01-24 18:24:55 +0100 | [diff] [blame] | 184 | "" |
| 185 | ] |
| 186 | } |
| 187 | } |
| 188 | ], |
| 189 | "request": { |
| 190 | "url": "{{url-nbi}}/nbi/api/v3/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": { |
| 231 | "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", |
| 232 | "host": [ |
| 233 | "{{url-nbi}}" |
| 234 | ], |
| 235 | "path": [ |
| 236 | "nbi", |
| 237 | "api", |
| 238 | "v3", |
| 239 | "service", |
| 240 | "{{auto_service_instance_id}}" |
| 241 | ], |
| 242 | "query": [ |
| 243 | { |
| 244 | "key": "relatedParty.id", |
| 245 | "value": "{{customer_name}}", |
| 246 | "equals": true, |
| 247 | "description": "" |
| 248 | }, |
| 249 | { |
| 250 | "key": "serviceSpecification.name", |
| 251 | "value": "{{service}}", |
| 252 | "equals": true, |
| 253 | "description": "" |
| 254 | } |
| 255 | ], |
| 256 | "variable": [] |
| 257 | }, |
| 258 | "method": "GET", |
| 259 | "header": [], |
| 260 | "body": {}, |
| 261 | "description": "" |
| 262 | }, |
| 263 | "response": [] |
| 264 | }, |
| 265 | { |
| 266 | "name": "Delete service Instance via ServiceOrder API", |
| 267 | "event": [ |
| 268 | { |
| 269 | "listen": "test", |
| 270 | "script": { |
| 271 | "type": "text/javascript", |
| 272 | "exec": [ |
| 273 | "tests[\"Status code is 201\"] = responseCode.code === 201;", |
| 274 | "", |
| 275 | "var jsonData = JSON.parse(responseBody);", |
| 276 | "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);", |
| 277 | "", |
| 278 | "", |
| 279 | "", |
| 280 | "" |
| 281 | ] |
| 282 | } |
| 283 | } |
| 284 | ], |
| 285 | "request": { |
| 286 | "url": "{{url-nbi}}/nbi/api/v3/serviceOrder", |
| 287 | "method": "POST", |
| 288 | "header": [ |
| 289 | { |
| 290 | "key": "Accept", |
| 291 | "value": "application/json", |
| 292 | "description": "" |
| 293 | }, |
| 294 | { |
| 295 | "key": "Content-Type", |
| 296 | "value": "application/json", |
| 297 | "description": "" |
| 298 | } |
| 299 | ], |
| 300 | "body": { |
| 301 | "mode": "raw", |
| 302 | "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}" |
| 303 | }, |
| 304 | "description": "" |
| 305 | }, |
| 306 | "response": [] |
| 307 | }, |
| 308 | { |
| 309 | "name": "DELAY 10s", |
| 310 | "request": { |
| 311 | "url": "https://postman-echo.com/delay/10", |
| 312 | "method": "GET", |
| 313 | "header": [], |
| 314 | "body": { |
| 315 | "mode": "raw", |
| 316 | "raw": "" |
| 317 | }, |
| 318 | "description": "" |
| 319 | }, |
| 320 | "response": [] |
| 321 | }, |
| 322 | { |
| 323 | "name": "GET previous serviceOrder", |
| 324 | "event": [ |
| 325 | { |
| 326 | "listen": "test", |
| 327 | "script": { |
| 328 | "type": "text/javascript", |
| 329 | "exec": [ |
| 330 | "", |
| 331 | "tests[\"Status code is 200\"] = responseCode.code === 200;", |
| 332 | "", |
| 333 | "var jsonData = JSON.parse(responseBody);", |
| 334 | "", |
| 335 | "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", |
| 336 | "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");", |
| 337 | "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";", |
| 338 | "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";", |
| 339 | "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");", |
| 340 | "" |
| 341 | ] |
| 342 | } |
| 343 | } |
| 344 | ], |
| 345 | "request": { |
| 346 | "url": "{{url-nbi}}/nbi/api/v3/serviceOrder/{{auto_service_order_id}}", |
| 347 | "method": "GET", |
| 348 | "header": [ |
| 349 | { |
| 350 | "key": "Accept", |
| 351 | "value": "application/json", |
| 352 | "description": "" |
| 353 | }, |
| 354 | { |
| 355 | "key": "Content-Type", |
| 356 | "value": "application/json", |
| 357 | "description": "" |
| 358 | } |
| 359 | ], |
| 360 | "body": { |
| 361 | "mode": "raw", |
| 362 | "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}" |
| 363 | }, |
| 364 | "description": "" |
| 365 | }, |
| 366 | "response": [] |
| 367 | }, |
| 368 | { |
| 369 | "name": "GET service instance in inventory (should no longer exists)", |
| 370 | "event": [ |
| 371 | { |
| 372 | "listen": "test", |
| 373 | "script": { |
| 374 | "type": "text/javascript", |
| 375 | "exec": [ |
| 376 | "", |
| 377 | "tests[\"Status code is 200\"] = responseCode.code === 200;", |
| 378 | "", |
| 379 | "", |
| 380 | "" |
| 381 | ] |
| 382 | } |
| 383 | } |
| 384 | ], |
| 385 | "request": { |
| 386 | "url": { |
| 387 | "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", |
| 388 | "host": [ |
| 389 | "{{url-nbi}}" |
| 390 | ], |
| 391 | "path": [ |
| 392 | "nbi", |
| 393 | "api", |
| 394 | "v3", |
| 395 | "service", |
| 396 | "{{auto_service_instance_id}}" |
| 397 | ], |
| 398 | "query": [ |
| 399 | { |
| 400 | "key": "relatedParty.id", |
| 401 | "value": "{{customer_name}}", |
| 402 | "equals": true, |
| 403 | "description": "" |
| 404 | }, |
| 405 | { |
| 406 | "key": "serviceSpecification.name", |
| 407 | "value": "{{service}}", |
| 408 | "equals": true, |
| 409 | "description": "" |
| 410 | } |
| 411 | ], |
| 412 | "variable": [] |
| 413 | }, |
| 414 | "method": "GET", |
| 415 | "header": [], |
| 416 | "body": {}, |
| 417 | "description": "" |
| 418 | }, |
| 419 | "response": [] |
| 420 | }, |
| 421 | { |
| 422 | "name": "GET all service instance via ServiceInventory API", |
| 423 | "event": [ |
| 424 | { |
| 425 | "listen": "test", |
| 426 | "script": { |
| 427 | "type": "text/javascript", |
| 428 | "exec": [ |
| 429 | "", |
| 430 | "", |
| 431 | "tests[\"Status code is 200\"] = responseCode.code === 200;", |
| 432 | "", |
| 433 | "var jsonData = JSON.parse(responseBody);", |
| 434 | "var service_instance_found = false;", |
| 435 | "for (var i = 0; i < jsonData.length; i++) { ", |
| 436 | " if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {", |
| 437 | " service_instance_found = true;", |
| 438 | " }", |
| 439 | "}", |
| 440 | "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;" |
| 441 | ] |
| 442 | } |
| 443 | } |
| 444 | ], |
| 445 | "request": { |
| 446 | "url": { |
| 447 | "raw": "{{url-nbi}}/nbi/api/v3/service?relatedParty.id={{customer_name}}", |
| 448 | "host": [ |
| 449 | "{{url-nbi}}" |
| 450 | ], |
| 451 | "path": [ |
| 452 | "nbi", |
| 453 | "api", |
| 454 | "v3", |
| 455 | "service" |
| 456 | ], |
| 457 | "query": [ |
| 458 | { |
| 459 | "key": "relatedParty.id", |
| 460 | "value": "{{customer_name}}", |
| 461 | "equals": true, |
| 462 | "description": "" |
| 463 | } |
| 464 | ], |
| 465 | "variable": [] |
| 466 | }, |
| 467 | "method": "GET", |
| 468 | "header": [], |
| 469 | "body": {}, |
| 470 | "description": "" |
| 471 | }, |
| 472 | "response": [] |
| 473 | }, |
| 474 | { |
| 475 | "name": "GET hubs", |
| 476 | "event": [ |
| 477 | { |
| 478 | "listen": "test", |
| 479 | "script": { |
| 480 | "type": "text/javascript", |
| 481 | "exec": [ |
| 482 | "tests[\"Status code is 200\"] = responseCode.code === 200;", |
| 483 | "" |
| 484 | ] |
| 485 | } |
| 486 | } |
| 487 | ], |
| 488 | "request": { |
| 489 | "url": "{{url-nbi}}/nbi/api/v3/hub", |
| 490 | "method": "GET", |
| 491 | "header": [], |
| 492 | "body": {}, |
| 493 | "description": "" |
| 494 | }, |
| 495 | "response": [] |
| 496 | } |
| 497 | ] |
| 498 | } |