add Postman Collection
[integration.git] / test / postman / 08_Declare_Customer_Service_Subscription_Cloud.postman_collection.json
1 {
2         "variables": [],
3         "info": {
4                 "name": "08_Declare_Customer_Service_Subscription_Cloud",
5                 "_postman_id": "ea6f17c2-1abd-62ff-a260-17fad1bdf6b8",
6                 "description": "",
7                 "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
8         },
9         "item": [
10                 {
11                         "name": "List Customers",
12                         "event": [
13                                 {
14                                         "listen": "test",
15                                         "script": {
16                                                 "type": "text/javascript",
17                                                 "exec": [
18                                                         "var customer_found = false;",
19                                                         "if (responseCode.code === 404) {",
20                                                         "    tests[postman.getGlobalVariable(\"customer_name\")+\" does not exists\"] = true;",
21                                                         "}",
22                                                         "else {",
23                                                         "    if (responseCode.code === 200) {",
24                                                         "        tests[\"Status code is 200\"] = responseCode.code === 200;",
25                                                         "        }",
26                                                         "    var jsonData = JSON.parse(responseBody);",
27                                                         "    for (var i = 0; i < jsonData.customer.length; i++) { ",
28                                                         "       if (jsonData.customer[i][\"global-customer-id\"] === postman.getGlobalVariable(\"customer_name\")) {",
29                                                         "           customer_found = true;",
30                                                         "           postman.setGlobalVariable(\"auto_customer_id\", \"\"+jsonData.customer[i][\"global-customer-id\"]+\"\");",
31                                                         "       }",
32                                                         "    }",
33                                                         "    if (customer_found === false) {",
34                                                         "        tests[postman.getGlobalVariable(\"customer_name\")+\" does not exists\"] = true;",
35                                                         "    }",
36                                                         "    ",
37                                                         "    else {",
38                                                         "        tests[postman.getGlobalVariable(\"customer_name\")+\" already exists, we skip creation\"] = true;",
39                                                         "        postman.setNextRequest(\"List Services from SDC catalog\");",
40                                                         "    }",
41                                                         "}"
42                                                 ]
43                                         }
44                                 }
45                         ],
46                         "request": {
47                                 "url": "{{url-aai}}/aai/v14/business/customers",
48                                 "method": "GET",
49                                 "header": [
50                                         {
51                                                 "key": "Authorization",
52                                                 "value": "Basic QUFJOkFBSQ==",
53                                                 "description": ""
54                                         },
55                                         {
56                                                 "key": "X-FromAppId",
57                                                 "value": "AAI",
58                                                 "description": ""
59                                         },
60                                         {
61                                                 "key": "Accept",
62                                                 "value": "application/json",
63                                                 "description": ""
64                                         },
65                                         {
66                                                 "key": "Content-Type",
67                                                 "value": "application/json",
68                                                 "description": ""
69                                         },
70                                         {
71                                                 "key": "X-TransactionId",
72                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
73                                                 "description": ""
74                                         }
75                                 ],
76                                 "body": {
77                                         "mode": "raw",
78                                         "raw": "{\r\n    \"global-customer-id\": \"Chouchen22\",\r\n    \"subscriber-name\": \"Chouchen22\",\r\n    \"subscriber-type\": \"INFRA\"\r\n}"
79                                 },
80                                 "description": ""
81                         },
82                         "response": []
83                 },
84                 {
85                         "name": "Declare a Customer",
86                         "event": [
87                                 {
88                                         "listen": "test",
89                                         "script": {
90                                                 "type": "text/javascript",
91                                                 "exec": [
92                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;"
93                                                 ]
94                                         }
95                                 }
96                         ],
97                         "request": {
98                                 "url": "{{url-aai}}/aai/v14/business/customers/customer/{{customer_name}}",
99                                 "method": "PUT",
100                                 "header": [
101                                         {
102                                                 "key": "Authorization",
103                                                 "value": "Basic QUFJOkFBSQ==",
104                                                 "description": ""
105                                         },
106                                         {
107                                                 "key": "X-FromAppId",
108                                                 "value": "AAI",
109                                                 "description": ""
110                                         },
111                                         {
112                                                 "key": "Accept",
113                                                 "value": "application/json",
114                                                 "description": ""
115                                         },
116                                         {
117                                                 "key": "Content-Type",
118                                                 "value": "application/json",
119                                                 "description": ""
120                                         },
121                                         {
122                                                 "key": "X-TransactionId",
123                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
124                                                 "description": ""
125                                         }
126                                 ],
127                                 "body": {
128                                         "mode": "raw",
129                                         "raw": "{\n    \"global-customer-id\": \"{{customer_name}}\",\n    \"subscriber-name\": \"{{customer_name}}\",\n    \"subscriber-type\": \"INFRA\"\n}"
130                                 },
131                                 "description": ""
132                         },
133                         "response": []
134                 },
135                 {
136                         "name": "Check customer creation",
137                         "event": [
138                                 {
139                                         "listen": "test",
140                                         "script": {
141                                                 "type": "text/javascript",
142                                                 "exec": [
143                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
144                                                         "",
145                                                         "var jsonData = JSON.parse(responseBody);",
146                                                         "var customer_found = false;",
147                                                         "for (var i = 0; i < jsonData.customer.length; i++) { ",
148                                                         "   if (jsonData.customer[i][\"global-customer-id\"] === postman.getGlobalVariable(\"customer_name\")) {",
149                                                         "       customer_found = true;",
150                                                         "       postman.setGlobalVariable(\"auto_customer_id\", \"\"+jsonData.customer[i][\"global-customer-id\"]+\"\");",
151                                                         "   }",
152                                                         "}",
153                                                         "tests[postman.getGlobalVariable(\"customer_name\")+\" found\"] = customer_found === true;"
154                                                 ]
155                                         }
156                                 }
157                         ],
158                         "request": {
159                                 "url": "{{url-aai}}/aai/v14/business/customers",
160                                 "method": "GET",
161                                 "header": [
162                                         {
163                                                 "key": "Authorization",
164                                                 "value": "Basic QUFJOkFBSQ==",
165                                                 "description": ""
166                                         },
167                                         {
168                                                 "key": "X-FromAppId",
169                                                 "value": "AAI",
170                                                 "description": ""
171                                         },
172                                         {
173                                                 "key": "Accept",
174                                                 "value": "application/json",
175                                                 "description": ""
176                                         },
177                                         {
178                                                 "key": "Content-Type",
179                                                 "value": "application/json",
180                                                 "description": ""
181                                         },
182                                         {
183                                                 "key": "X-TransactionId",
184                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
185                                                 "description": ""
186                                         }
187                                 ],
188                                 "body": {
189                                         "mode": "raw",
190                                         "raw": "{\r\n    \"global-customer-id\": \"Chouchen22\",\r\n    \"subscriber-name\": \"Chouchen22\",\r\n    \"subscriber-type\": \"INFRA\"\r\n}"
191                                 },
192                                 "description": ""
193                         },
194                         "response": []
195                 },
196                 {
197                         "name": "List Services from SDC catalog",
198                         "event": [
199                                 {
200                                         "listen": "test",
201                                         "script": {
202                                                 "type": "text/javascript",
203                                                 "exec": [
204                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
205                                                         "",
206                                                         "var jsonData = JSON.parse(responseBody);",
207                                                         "var service_found = false;",
208                                                         "for (var i = 0; i < jsonData.length; i++) { ",
209                                                         "   if (jsonData[i][\"name\"] === postman.getGlobalVariable(\"service\")) {",
210                                                         "       service_found = true;",
211                                                         "       postman.setGlobalVariable(\"auto_service_invariantUUID\", \"\"+jsonData[i][\"invariantUUID\"]+\"\");",
212                                                         "   }",
213                                                         "}",
214                                                         "",
215                                                         "if (service_found === false) {",
216                                                         "    tests[postman.getGlobalVariable(\"service\")+\" does not exists\"] = true;",
217                                                         "    postman.setNextRequest(null);",
218                                                         "}",
219                                                         "",
220                                                         "else {",
221                                                         "    tests[postman.getGlobalVariable(\"service\")+\" exists, we continue the run\"] = true;",
222                                                         "}"
223                                                 ]
224                                         }
225                                 }
226                         ],
227                         "request": {
228                                 "url": "{{url-sdc}}/sdc/v1/catalog/services",
229                                 "method": "GET",
230                                 "header": [
231                                         {
232                                                 "key": "Content-Type",
233                                                 "value": "application/json",
234                                                 "description": ""
235                                         },
236                                         {
237                                                 "key": "Accept",
238                                                 "value": "application/json",
239                                                 "description": ""
240                                         },
241                                         {
242                                                 "key": "X-TransactionId",
243                                                 "value": "ONAP-Test",
244                                                 "description": ""
245                                         },
246                                         {
247                                                 "key": "USER_ID",
248                                                 "value": "cs0008",
249                                                 "description": ""
250                                         },
251                                         {
252                                                 "key": "X-FromAppId",
253                                                 "value": "ONAP-Test",
254                                                 "description": ""
255                                         },
256                                         {
257                                                 "key": "Authorization",
258                                                 "value": "Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=",
259                                                 "description": ""
260                                         },
261                                         {
262                                                 "key": "x-ecomp-instanceid",
263                                                 "value": "ONAP-Test",
264                                                 "description": ""
265                                         }
266                                 ],
267                                 "body": {
268                                         "mode": "raw",
269                                         "raw": "{\"contactId\": \"cs0008\", \"vendorRelease\": \"1.0\", \"requirements\": {}, \"artifacts\": {}, \"capabilities\": {}, \"componentInstancesProperties\": {}, \"deploymentArtifacts\": {}, \"icon\": \"defaulticon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor software product\", \"tags\": [\"test-vsp\"], \"groups\": [], \"properties\": [], \"categories\": [{\"subcategories\": [{\"normalizedName\": \"abstract\", \"name\": \"Abstract\", \"uniqueId\": \"resourceNewCategory.generic.abstract\", \"icons\": [\"icon\"]}], \"normalizedName\": \"generic\", \"name\": \"Generic\", \"uniqueId\": \"resourceNewCategory.generic\"}], \"name\": \"test-vsp\", \"toscaArtifacts\": {}, \"csarUUID\": \"F3CD5189C2DF45B4B1CFA6D6E45FD613\", \"resourceType\": \"VF\", \"csarVersion\": \"1.0\", \"componentType\": \"RESOURCE\", \"componentInstancesAttributes\": {}, \"attributes\": [], \"componentInstances\": []}"
270                                 },
271                                 "description": ""
272                         },
273                         "response": []
274                 },
275                 {
276                         "name": "Check Subscription in AAI",
277                         "event": [
278                                 {
279                                         "listen": "test",
280                                         "script": {
281                                                 "type": "text/javascript",
282                                                 "exec": [
283                                                         "var service_found = false;",
284                                                         "if (responseCode.code === 404) {",
285                                                         "    tests[postman.getGlobalVariable(\"service\")+\" does not exists in AAI\"] = true;",
286                                                         "}",
287                                                         "else {",
288                                                         "    if (responseCode.code === 200) {",
289                                                         "        tests[\"Status code is 200\"] = responseCode.code === 200;",
290                                                         "        }",
291                                                         "    var jsonData = JSON.parse(responseBody);",
292                                                         "    for (var i = 0; i < jsonData.service.length; i++) { ",
293                                                         "       if (jsonData.service[i][\"service-description\"] === postman.getGlobalVariable(\"service\")) {",
294                                                         "           service_found = true;",
295                                                         "       }",
296                                                         "    }",
297                                                         "    ",
298                                                         "    if (service_found === false) {",
299                                                         "        tests[postman.getGlobalVariable(\"service\")+\" does not exists in AAI\"] = true;",
300                                                         "    }",
301                                                         "    ",
302                                                         "    else {",
303                                                         "        tests[postman.getGlobalVariable(\"service\")+\" already exists in AAI, we skip creation\"] = true;",
304                                                         "        postman.setNextRequest(\"check cloud-region exists\");",
305                                                         "    }",
306                                                         "}"
307                                                 ]
308                                         }
309                                 }
310                         ],
311                         "request": {
312                                 "url": "{{url-aai}}/aai/v14/service-design-and-creation/services",
313                                 "method": "GET",
314                                 "header": [
315                                         {
316                                                 "key": "Accept",
317                                                 "value": "application/json",
318                                                 "description": ""
319                                         },
320                                         {
321                                                 "key": "Content-Type",
322                                                 "value": "application/json",
323                                                 "description": ""
324                                         },
325                                         {
326                                                 "key": "X-FromAppId",
327                                                 "value": "AAI",
328                                                 "description": ""
329                                         },
330                                         {
331                                                 "key": "X-TransactionId",
332                                                 "value": "get_aai_subscr",
333                                                 "description": ""
334                                         },
335                                         {
336                                                 "key": "Authorization",
337                                                 "value": "Basic QUFJOkFBSQ==",
338                                                 "description": ""
339                                         }
340                                 ],
341                                 "body": {
342                                         "mode": "raw",
343                                         "raw": ""
344                                 },
345                                 "description": ""
346                         },
347                         "response": []
348                 },
349                 {
350                         "name": "Declare subscription in AAI",
351                         "request": {
352                                 "url": "{{url-aai}}/aai/v14/service-design-and-creation/services/service/{{auto_service_invariantUUID}}",
353                                 "method": "PUT",
354                                 "header": [
355                                         {
356                                                 "key": "Authorization",
357                                                 "value": "Basic QUFJOkFBSQ==",
358                                                 "description": ""
359                                         },
360                                         {
361                                                 "key": "X-FromAppId",
362                                                 "value": "AAI",
363                                                 "description": ""
364                                         },
365                                         {
366                                                 "key": "Accept",
367                                                 "value": "application/json",
368                                                 "description": ""
369                                         },
370                                         {
371                                                 "key": "X-TransactionId",
372                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
373                                                 "description": ""
374                                         },
375                                         {
376                                                 "key": "Content-Type",
377                                                 "value": "application/json",
378                                                 "description": ""
379                                         }
380                                 ],
381                                 "body": {
382                                         "mode": "raw",
383                                         "raw": "{\r\n\"service-id\": \"{{auto_service_invariantUUID}}\",\r\n\"service-description\": \"{{service}}\"\r\n}"
384                                 },
385                                 "description": ""
386                         },
387                         "response": []
388                 },
389                 {
390                         "name": "Check Subscription creation in AAI",
391                         "event": [
392                                 {
393                                         "listen": "test",
394                                         "script": {
395                                                 "type": "text/javascript",
396                                                 "exec": [
397                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
398                                                         "",
399                                                         "var jsonData = JSON.parse(responseBody);",
400                                                         "var service_found = false;",
401                                                         "for (var i = 0; i < jsonData.service.length; i++) { ",
402                                                         "   if (jsonData.service[i][\"service-description\"] === postman.getGlobalVariable(\"service\")) {",
403                                                         "       service_found = true;",
404                                                         "       postman.setGlobalVariable(\"auto_service_resource_version\", \"\"+jsonData.service[i][\"resource-version\"]+\"\");",
405                                                         "   }",
406                                                         "}",
407                                                         "tests[postman.getGlobalVariable(\"service\")+\" found\"] = service_found === true;"
408                                                 ]
409                                         }
410                                 }
411                         ],
412                         "request": {
413                                 "url": "{{url-aai}}/aai/v14/service-design-and-creation/services",
414                                 "method": "GET",
415                                 "header": [
416                                         {
417                                                 "key": "Accept",
418                                                 "value": "application/json",
419                                                 "description": ""
420                                         },
421                                         {
422                                                 "key": "Content-Type",
423                                                 "value": "application/json",
424                                                 "description": ""
425                                         },
426                                         {
427                                                 "key": "X-FromAppId",
428                                                 "value": "AAI",
429                                                 "description": ""
430                                         },
431                                         {
432                                                 "key": "X-TransactionId",
433                                                 "value": "get_aai_subscr",
434                                                 "description": ""
435                                         },
436                                         {
437                                                 "key": "Authorization",
438                                                 "value": "Basic QUFJOkFBSQ==",
439                                                 "description": ""
440                                         }
441                                 ],
442                                 "body": {
443                                         "mode": "raw",
444                                         "raw": ""
445                                 },
446                                 "description": ""
447                         },
448                         "response": []
449                 },
450                 {
451                         "name": "check cloud-region exists",
452                         "event": [
453                                 {
454                                         "listen": "test",
455                                         "script": {
456                                                 "type": "text/javascript",
457                                                 "exec": [
458                                                         "var region_found = false;",
459                                                         "if (responseCode.code === 404) {",
460                                                         "    tests[postman.getGlobalVariable(\"cloud_region_id\")+\" does not exists in AAI\"] = true;",
461                                                         "}",
462                                                         "else {",
463                                                         "    if (responseCode.code === 200) {",
464                                                         "        tests[\"Status code is 200\"] = responseCode.code === 200;",
465                                                         "        }",
466                                                         "var jsonData = JSON.parse(responseBody);",
467                                                         "for (var i = 0; i < jsonData[\"cloud-region\"].length; i++) { ",
468                                                         "   if (jsonData[\"cloud-region\"][i][\"cloud-region-id\"] === postman.getGlobalVariable(\"cloud_region_id\")) {",
469                                                         "       region_found = true;",
470                                                         "   }",
471                                                         "}",
472                                                         "",
473                                                         "if (region_found === false) {",
474                                                         "    tests[postman.getGlobalVariable(\"cloud_region_id\")+\" does not exists\"] = true;",
475                                                         "}",
476                                                         "else {",
477                                                         "    tests[postman.getGlobalVariable(\"cloud_region_id\")+\" already exists, we skip creation\"] = true;",
478                                                         "    postman.setNextRequest(\"check tenant in cloud region\");",
479                                                         "}",
480                                                         "}"
481                                                 ]
482                                         }
483                                 }
484                         ],
485                         "request": {
486                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions",
487                                 "method": "GET",
488                                 "header": [
489                                         {
490                                                 "key": "Authorization",
491                                                 "value": "Basic QUFJOkFBSQ==",
492                                                 "description": ""
493                                         },
494                                         {
495                                                 "key": "X-FromAppId",
496                                                 "value": "AAI",
497                                                 "description": ""
498                                         },
499                                         {
500                                                 "key": "Accept",
501                                                 "value": "application/json",
502                                                 "description": ""
503                                         },
504                                         {
505                                                 "key": "X-TransactionId",
506                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
507                                                 "description": ""
508                                         }
509                                 ],
510                                 "body": {},
511                                 "description": ""
512                         },
513                         "response": []
514                 },
515                 {
516                         "name": "create CloudOwner/RegionOne cloud-region",
517                         "event": [
518                                 {
519                                         "listen": "test",
520                                         "script": {
521                                                 "type": "text/javascript",
522                                                 "exec": [
523                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;"
524                                                 ]
525                                         }
526                                 }
527                         ],
528                         "request": {
529                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{{cloud_owner_name}}/{{cloud_region_id}}",
530                                 "method": "PUT",
531                                 "header": [
532                                         {
533                                                 "key": "Authorization",
534                                                 "value": "Basic QUFJOkFBSQ==",
535                                                 "description": ""
536                                         },
537                                         {
538                                                 "key": "X-FromAppId",
539                                                 "value": "AAI",
540                                                 "description": ""
541                                         },
542                                         {
543                                                 "key": "Accept",
544                                                 "value": "application/json",
545                                                 "description": ""
546                                         },
547                                         {
548                                                 "key": "X-TransactionId",
549                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
550                                                 "description": ""
551                                         },
552                                         {
553                                                 "key": "Content-Type",
554                                                 "value": "application/json",
555                                                 "description": ""
556                                         }
557                                 ],
558                                 "body": {
559                                         "mode": "raw",
560                                         "raw": "{\r\n    \"cloud-owner\": \"{{cloud_owner_name}}\",\r\n    \"cloud-region-id\": \"{{cloud_region_id}}\",\r\n    \"cloud-type\": \"openstack\",\r\n    \"owner-defined-type\": \"\",\r\n    \"cloud-region-version\": \"\",\r\n    \"cloud-zone\": \"\",\r\n    \"complex-name\": \"\",\r\n    \"identity-url\": \"\",\r\n    \"sriov-automation\": false,\r\n    \"cloud-extra-info\": \"\"\r\n}"
561                                 },
562                                 "description": ""
563                         },
564                         "response": []
565                 },
566                 {
567                         "name": "Check Cloud-region creation",
568                         "event": [
569                                 {
570                                         "listen": "test",
571                                         "script": {
572                                                 "type": "text/javascript",
573                                                 "exec": [
574                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
575                                                         "",
576                                                         "var jsonData = JSON.parse(responseBody);",
577                                                         "var region_found = false;",
578                                                         "for (var i = 0; i < jsonData[\"cloud-region\"].length; i++) { ",
579                                                         "   if (jsonData[\"cloud-region\"][i][\"cloud-region-id\"] === postman.getGlobalVariable(\"cloud_region_id\")) {",
580                                                         "       region_found = true;",
581                                                         "   }",
582                                                         "}",
583                                                         "tests[postman.getGlobalVariable(\"cloud_region_id\")+\" found\"] = region_found === true;",
584                                                         ""
585                                                 ]
586                                         }
587                                 }
588                         ],
589                         "request": {
590                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions",
591                                 "method": "GET",
592                                 "header": [
593                                         {
594                                                 "key": "Authorization",
595                                                 "value": "Basic QUFJOkFBSQ==",
596                                                 "description": ""
597                                         },
598                                         {
599                                                 "key": "X-FromAppId",
600                                                 "value": "AAI",
601                                                 "description": ""
602                                         },
603                                         {
604                                                 "key": "Accept",
605                                                 "value": "application/json",
606                                                 "description": ""
607                                         },
608                                         {
609                                                 "key": "X-TransactionId",
610                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
611                                                 "description": ""
612                                         }
613                                 ],
614                                 "body": {},
615                                 "description": ""
616                         },
617                         "response": []
618                 },
619                 {
620                         "name": "check tenant in cloud region",
621                         "event": [
622                                 {
623                                         "listen": "test",
624                                         "script": {
625                                                 "type": "text/javascript",
626                                                 "exec": [
627                                                         "var tenant_found = false;",
628                                                         "if (responseCode.code === 404) {",
629                                                         "    tests[postman.getGlobalVariable(\"tenant_name\")+\" does not exists in AAI\"] = true;",
630                                                         "}",
631                                                         "else {",
632                                                         "    if (responseCode.code === 200) {",
633                                                         "        tests[\"Status code is 200\"] = responseCode.code === 200;",
634                                                         "        }",
635                                                         "var jsonData = JSON.parse(responseBody);",
636                                                         "",
637                                                         "if(jsonData.hasOwnProperty('tenant'))",
638                                                         "    {",
639                                                         "    for (var i = 0; i < jsonData.tenant.length; i++) ",
640                                                         "        { ",
641                                                         "        if (jsonData.tenant[i]['tenant-id'] === postman.getGlobalVariable(\"tenant_id\")) ",
642                                                         "            {",
643                                                         "            tenant_found = true;",
644                                                         "            }",
645                                                         "        }",
646                                                         "    if (tenant_found === true) ",
647                                                         "        {",
648                                                         "        tests[postman.getGlobalVariable(\"tenant_name\")+\" already exists, we skip creation\"] = true;",
649                                                         "        postman.setNextRequest(\"check customer-service-tenant relations\");",
650                                                         "        }",
651                                                         "",
652                                                         "if (tenant_found === false)",
653                                                         "    {",
654                                                         "    tests[postman.getGlobalVariable(\"tenant_name\")+\" does not exists\"] = true;",
655                                                         "    }",
656                                                         "}",
657                                                         "}"
658                                                 ]
659                                         }
660                                 }
661                         ],
662                         "request": {
663                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{{cloud_owner_name}}/{{cloud_region_id}}/tenants",
664                                 "method": "GET",
665                                 "header": [
666                                         {
667                                                 "key": "Authorization",
668                                                 "value": "Basic QUFJOkFBSQ==",
669                                                 "description": ""
670                                         },
671                                         {
672                                                 "key": "X-FromAppId",
673                                                 "value": "AAI",
674                                                 "description": ""
675                                         },
676                                         {
677                                                 "key": "Accept",
678                                                 "value": "application/json",
679                                                 "description": ""
680                                         },
681                                         {
682                                                 "key": "X-TransactionId",
683                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
684                                                 "description": ""
685                                         },
686                                         {
687                                                 "key": "Content-Type",
688                                                 "value": "application/json",
689                                                 "description": ""
690                                         }
691                                 ],
692                                 "body": {},
693                                 "description": ""
694                         },
695                         "response": []
696                 },
697                 {
698                         "name": "add tenant to region",
699                         "event": [
700                                 {
701                                         "listen": "test",
702                                         "script": {
703                                                 "type": "text/javascript",
704                                                 "exec": [
705                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;"
706                                                 ]
707                                         }
708                                 }
709                         ],
710                         "request": {
711                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{{cloud_owner_name}}/{{cloud_region_id}}/tenants/tenant/{{tenant_id}}",
712                                 "method": "PUT",
713                                 "header": [
714                                         {
715                                                 "key": "Authorization",
716                                                 "value": "Basic QUFJOkFBSQ==",
717                                                 "description": ""
718                                         },
719                                         {
720                                                 "key": "X-FromAppId",
721                                                 "value": "AAI",
722                                                 "description": ""
723                                         },
724                                         {
725                                                 "key": "Accept",
726                                                 "value": "application/json",
727                                                 "description": ""
728                                         },
729                                         {
730                                                 "key": "X-TransactionId",
731                                                 "value": "get_aai_subscr",
732                                                 "description": ""
733                                         },
734                                         {
735                                                 "key": "Content-Type",
736                                                 "value": "application/json",
737                                                 "description": ""
738                                         }
739                                 ],
740                                 "body": {
741                                         "mode": "raw",
742                                         "raw": "{\n    \"tenant-id\": \"{{tenant_id}}\",\n    \"tenant-name\": \"{{tenant_name}}\"\n}"
743                                 },
744                                 "description": ""
745                         },
746                         "response": []
747                 },
748                 {
749                         "name": "check tenant creation",
750                         "event": [
751                                 {
752                                         "listen": "test",
753                                         "script": {
754                                                 "type": "text/javascript",
755                                                 "exec": [
756                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
757                                                         "",
758                                                         "var jsonData = JSON.parse(responseBody);",
759                                                         "var tenant_found = false;",
760                                                         "for (var i = 0; i < jsonData[\"tenant\"].length; i++) { ",
761                                                         "   if (jsonData[\"tenant\"][i][\"tenant-id\"] === postman.getGlobalVariable(\"tenant_id\")) {",
762                                                         "       tenant_found = true;",
763                                                         "   }",
764                                                         "}",
765                                                         "tests[postman.getGlobalVariable(\"tenant_name\")+\" found\"] = tenant_found === true;",
766                                                         ""
767                                                 ]
768                                         }
769                                 }
770                         ],
771                         "request": {
772                                 "url": "{{url-aai}}/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{{cloud_owner_name}}/{{cloud_region_id}}/tenants",
773                                 "method": "GET",
774                                 "header": [
775                                         {
776                                                 "key": "Authorization",
777                                                 "value": "Basic QUFJOkFBSQ==",
778                                                 "description": ""
779                                         },
780                                         {
781                                                 "key": "X-FromAppId",
782                                                 "value": "AAI",
783                                                 "description": ""
784                                         },
785                                         {
786                                                 "key": "Accept",
787                                                 "value": "application/json",
788                                                 "description": ""
789                                         },
790                                         {
791                                                 "key": "X-TransactionId",
792                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
793                                                 "description": ""
794                                         },
795                                         {
796                                                 "key": "Content-Type",
797                                                 "value": "application/json",
798                                                 "description": ""
799                                         }
800                                 ],
801                                 "body": {},
802                                 "description": ""
803                         },
804                         "response": []
805                 },
806                 {
807                         "name": "check customer-service-tenant relations",
808                         "event": [
809                                 {
810                                         "listen": "test",
811                                         "script": {
812                                                 "type": "text/javascript",
813                                                 "exec": [
814                                                         "var relation_found = false;",
815                                                         "if (responseCode.code === 404) {",
816                                                         "    tests[postman.getGlobalVariable(\"tenant_name\")+\" / \"+postman.getGlobalVariable(\"service\")+ \" relation does not exists\"] = true;",
817                                                         "}",
818                                                         "else {",
819                                                         "    if (responseCode.code === 200) {",
820                                                         "        tests[\"Status code is 200\"] = responseCode.code === 200;",
821                                                         "        }",
822                                                         "",
823                                                         "var jsonData = JSON.parse(responseBody);",
824                                                         "for (var i = 0; i < jsonData[\"service-subscription\"].length; i++) { ",
825                                                         "   if (jsonData[\"service-subscription\"][i][\"service-type\"] === postman.getGlobalVariable(\"service\")) {",
826                                                         "       relation_found = true;",
827                                                         "   }",
828                                                         "}",
829                                                         "",
830                                                         "if (relation_found === false) {",
831                                                         "    tests[postman.getGlobalVariable(\"tenant_name\")+\" / \"+postman.getGlobalVariable(\"service\")+ \" relation does not exists\"] = true;",
832                                                         "}",
833                                                         "",
834                                                         "else {",
835                                                         "    tests[postman.getGlobalVariable(\"tenant_name\")+\" / \"+postman.getGlobalVariable(\"service\")+ \" already exists, we skip relation creation\"] = true;",
836                                                         "    postman.setNextRequest(\"check customer-service-tenant relation creation\");",
837                                                         "}",
838                                                         "}"
839                                                 ]
840                                         }
841                                 }
842                         ],
843                         "request": {
844                                 "url": {
845                                         "raw": "{{url-aai}}/aai/v14/business/customers/customer/{{customer_name}}/service-subscriptions?depth=all",
846                                         "host": [
847                                                 "{{url-aai}}"
848                                         ],
849                                         "path": [
850                                                 "aai",
851                                                 "v14",
852                                                 "business",
853                                                 "customers",
854                                                 "customer",
855                                                 "{{customer_name}}",
856                                                 "service-subscriptions"
857                                         ],
858                                         "query": [
859                                                 {
860                                                         "key": "depth",
861                                                         "value": "all",
862                                                         "equals": true,
863                                                         "description": ""
864                                                 }
865                                         ],
866                                         "variable": []
867                                 },
868                                 "method": "GET",
869                                 "header": [
870                                         {
871                                                 "key": "Authorization",
872                                                 "value": "Basic QUFJOkFBSQ==",
873                                                 "description": ""
874                                         },
875                                         {
876                                                 "key": "X-FromAppId",
877                                                 "value": "AAI",
878                                                 "description": ""
879                                         },
880                                         {
881                                                 "key": "Accept",
882                                                 "value": "application/json",
883                                                 "description": ""
884                                         },
885                                         {
886                                                 "key": "Content-Type",
887                                                 "value": "application/json",
888                                                 "description": ""
889                                         },
890                                         {
891                                                 "key": "X-TransactionId",
892                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
893                                                 "description": ""
894                                         }
895                                 ],
896                                 "body": {
897                                         "mode": "raw",
898                                         "raw": "{\r\n    \"global-customer-id\": \"Sina\",\r\n    \"subscriber-name\": \"Sina\",\r\n    \"subscriber-type\": \"INFRA\"\r\n}"
899                                 },
900                                 "description": ""
901                         },
902                         "response": []
903                 },
904                 {
905                         "name": "Add customer-service-tenant relations init",
906                         "event": [
907                                 {
908                                         "listen": "test",
909                                         "script": {
910                                                 "type": "text/javascript",
911                                                 "exec": [
912                                                         "tests[\"Status code is 201\"] = responseCode.code === 201;"
913                                                 ]
914                                         }
915                                 }
916                         ],
917                         "request": {
918                                 "url": {
919                                         "raw": "{{url-aai}}/aai/v14/business/customers/customer/{{customer_name}}/service-subscriptions/service-subscription/{{service}}?resource-version={{auto_service_resource_version}}",
920                                         "host": [
921                                                 "{{url-aai}}"
922                                         ],
923                                         "path": [
924                                                 "aai",
925                                                 "v14",
926                                                 "business",
927                                                 "customers",
928                                                 "customer",
929                                                 "{{customer_name}}",
930                                                 "service-subscriptions",
931                                                 "service-subscription",
932                                                 "{{service}}"
933                                         ],
934                                         "query": [
935                                                 {
936                                                         "key": "resource-version",
937                                                         "value": "{{auto_service_resource_version}}",
938                                                         "equals": true,
939                                                         "description": ""
940                                                 }
941                                         ],
942                                         "variable": []
943                                 },
944                                 "method": "PUT",
945                                 "header": [
946                                         {
947                                                 "key": "Authorization",
948                                                 "value": "Basic QUFJOkFBSQ==",
949                                                 "description": ""
950                                         },
951                                         {
952                                                 "key": "X-FromAppId",
953                                                 "value": "AAI",
954                                                 "description": ""
955                                         },
956                                         {
957                                                 "key": "Accept",
958                                                 "value": "application/json",
959                                                 "description": ""
960                                         },
961                                         {
962                                                 "key": "Content-Type",
963                                                 "value": "application/json",
964                                                 "description": ""
965                                         },
966                                         {
967                                                 "key": "X-TransactionId",
968                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
969                                                 "description": ""
970                                         }
971                                 ],
972                                 "body": {
973                                         "mode": "raw",
974                                         "raw": "{\r\n\t\"service-type\": \"{{service}}\",\r\n\t\"relationship-list\": {\r\n\t\t\"relationship\": [{\r\n\t\t\t\"related-to\": \"tenant\",\r\n\t\t\t\"related-link\": \"https://aai.api.simpledemo.onap.org:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{{cloud_owner_name}}/{{cloud_region_id}}/tenants/tenant/{{tenant_id}}\",\r\n\t\t\t\"relationship-data\": [{\r\n\t\t\t\t\t\"relationship-key\": \"cloud-region.cloud-owner\",\r\n\t\t\t\t\t\"relationship-value\": \"{{cloud_owner_name}}\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"relationship-key\": \"cloud-region.cloud-region-id\",\r\n\t\t\t\t\t\"relationship-value\": \"{{cloud_region_id}}\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"relationship-key\": \"tenant.tenant-id\",\r\n\t\t\t\t\t\"relationship-value\": \"{{tenant_id}}\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"related-to-property\": [{\r\n\t\t\t\t\"property-key\": \"tenant.tenant-name\",\r\n\t\t\t\t\"property-value\": \"{{tenant_name}}\"\r\n\t\t\t}]\r\n\t\t}]\r\n\t}\r\n}"
975                                 },
976                                 "description": ""
977                         },
978                         "response": []
979                 },
980                 {
981                         "name": "check customer-service-tenant relation creation",
982                         "event": [
983                                 {
984                                         "listen": "test",
985                                         "script": {
986                                                 "type": "text/javascript",
987                                                 "exec": [
988                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
989                                                         "",
990                                                         "var jsonData = JSON.parse(responseBody);",
991                                                         "var service_found = false;",
992                                                         "for (var i = 0; i < jsonData[\"service-subscription\"].length; i++) { ",
993                                                         "   if (jsonData[\"service-subscription\"][i][\"service-type\"] === postman.getGlobalVariable(\"service\")) {",
994                                                         "       service_found = true;",
995                                                         "   }",
996                                                         "}",
997                                                         "tests[postman.getGlobalVariable(\"service\")+\" found\"] = service_found === true;",
998                                                         ""
999                                                 ]
1000                                         }
1001                                 }
1002                         ],
1003                         "request": {
1004                                 "url": {
1005                                         "raw": "{{url-aai}}/aai/v14/business/customers/customer/{{customer_name}}/service-subscriptions?depth=all",
1006                                         "host": [
1007                                                 "{{url-aai}}"
1008                                         ],
1009                                         "path": [
1010                                                 "aai",
1011                                                 "v14",
1012                                                 "business",
1013                                                 "customers",
1014                                                 "customer",
1015                                                 "{{customer_name}}",
1016                                                 "service-subscriptions"
1017                                         ],
1018                                         "query": [
1019                                                 {
1020                                                         "key": "depth",
1021                                                         "value": "all",
1022                                                         "equals": true,
1023                                                         "description": ""
1024                                                 }
1025                                         ],
1026                                         "variable": []
1027                                 },
1028                                 "method": "GET",
1029                                 "header": [
1030                                         {
1031                                                 "key": "Authorization",
1032                                                 "value": "Basic QUFJOkFBSQ==",
1033                                                 "description": ""
1034                                         },
1035                                         {
1036                                                 "key": "X-FromAppId",
1037                                                 "value": "AAI",
1038                                                 "description": ""
1039                                         },
1040                                         {
1041                                                 "key": "Accept",
1042                                                 "value": "application/json",
1043                                                 "description": ""
1044                                         },
1045                                         {
1046                                                 "key": "Content-Type",
1047                                                 "value": "application/json",
1048                                                 "description": ""
1049                                         },
1050                                         {
1051                                                 "key": "X-TransactionId",
1052                                                 "value": "808b54e3-e563-4144-a1b9-e24e2ed93d4f",
1053                                                 "description": ""
1054                                         }
1055                                 ],
1056                                 "body": {
1057                                         "mode": "raw",
1058                                         "raw": "{\r\n    \"global-customer-id\": \"Sina\",\r\n    \"subscriber-name\": \"Sina\",\r\n    \"subscriber-type\": \"INFRA\"\r\n}"
1059                                 },
1060                                 "description": ""
1061                         },
1062                         "response": []
1063                 }
1064         ]
1065 }