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