From 9cd501a435ff429811d98406b5e0f137b4558540 Mon Sep 17 00:00:00 2001 From: Rene Robert Date: Fri, 25 Jan 2019 15:36:40 +0100 Subject: add README and corrections Issue-ID: INT-825 Change-Id: Iac316a6a17aff5acfc9061634232351c4ef305e2 Signed-off-by: Rene Robert (cherry picked from commit 6edc789ad4d624fe974ef1252be08f054acf67b4) --- test/postman/05_Onboard_VF.postman_collection.json | 36 +- .../10_Service Order.postman_collection.json | 494 --------------------- .../10_Service_Order.postman_collection.json | 494 +++++++++++++++++++++ test/postman/README.md | 68 +++ test/postman/globals.postman_globals.json | 6 +- test/postman/images/collection-detail-test.png | Bin 0 -> 123615 bytes test/postman/images/collection-detail.png | Bin 0 -> 83671 bytes test/postman/images/collections.png | Bin 0 -> 81167 bytes test/postman/images/globals.png | Bin 0 -> 111790 bytes test/postman/images/import.png | Bin 0 -> 83172 bytes test/postman/images/run.png | Bin 0 -> 93958 bytes test/postman/images/zipfile.png | Bin 0 -> 97349 bytes 12 files changed, 586 insertions(+), 512 deletions(-) delete mode 100644 test/postman/10_Service Order.postman_collection.json create mode 100644 test/postman/10_Service_Order.postman_collection.json create mode 100644 test/postman/README.md create mode 100755 test/postman/images/collection-detail-test.png create mode 100755 test/postman/images/collection-detail.png create mode 100755 test/postman/images/collections.png create mode 100755 test/postman/images/globals.png create mode 100755 test/postman/images/import.png create mode 100755 test/postman/images/run.png create mode 100755 test/postman/images/zipfile.png diff --git a/test/postman/05_Onboard_VF.postman_collection.json b/test/postman/05_Onboard_VF.postman_collection.json index 9b49aa4c8..19a83a0d3 100644 --- a/test/postman/05_Onboard_VF.postman_collection.json +++ b/test/postman/05_Onboard_VF.postman_collection.json @@ -15,24 +15,30 @@ "script": { "type": "text/javascript", "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", "var vf_found = false;", - "for (var i = 0; i < jsonData.length; i++) { ", - " if (jsonData[i][\"name\"] === postman.getGlobalVariable(\"vf_name\")) {", - " vf_found = true;", - " postman.setGlobalVariable(\"auto_vf_uuid\", \"\"+jsonData[i][\"uuid\"]+\"\");", - " postman.setGlobalVariable(\"auto_vf_invariant_uuid\", \"\"+jsonData[i][\"invariantUUID\"]+\"\");", - " }", + "if (responseCode.code === 404) {", + " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists\"] = true;", "}", - "if (vf_found === false) {", - " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists, we continue the run\"] = true;", - "}", - "", "else {", - " tests[postman.getGlobalVariable(\"vf_name\")+\" already exists, stop the run\"] = true;", - " postman.setNextRequest(null);", + " if (responseCode.code === 200) {", + " tests[\"Status code is 200\"] = responseCode.code === 200;", + " }", + " var jsonData = JSON.parse(responseBody);", + " for (var i = 0; i < jsonData.length; i++) { ", + " if (jsonData[i][\"name\"] === postman.getGlobalVariable(\"vf_name\")) {", + " vf_found = true;", + " postman.setGlobalVariable(\"auto_vf_uuid\", \"\"+jsonData[i][\"uuid\"]+\"\");", + " postman.setGlobalVariable(\"auto_vf_invariant_uuid\", \"\"+jsonData[i][\"invariantUUID\"]+\"\");", + " }", + " }", + " if (vf_found === false) {", + " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists, we continue the run\"] = true;", + " }", + " ", + " else {", + " tests[postman.getGlobalVariable(\"vf_name\")+\" already exists, stop the run\"] = true;", + " postman.setNextRequest(null);", + " }", "}" ] } diff --git a/test/postman/10_Service Order.postman_collection.json b/test/postman/10_Service Order.postman_collection.json deleted file mode 100644 index f29ee22e3..000000000 --- a/test/postman/10_Service Order.postman_collection.json +++ /dev/null @@ -1,494 +0,0 @@ -{ - "variables": [], - "info": { - "name": "10_Service Order", - "_postman_id": "28bdf2bb-4886-b8e7-45e3-eac832efc757", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "GET ExternalAPI-NBI component Status (HealthCheck)", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "", - "var jsonData = JSON.parse(responseBody);", - "tests[\"status\"] = jsonData.status === \"ok\";" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/status", - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "GET all service models from Service Catalog API", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", - "var service_found = false;", - "for (var i = 0; i < jsonData.length; i++) { ", - " if (jsonData[i].name === postman.getGlobalVariable(\"service\")) {", - " service_found = true;", - " postman.setGlobalVariable(\"auto_service_id\", \"\"+jsonData[i].id+\"\");", - " }", - "}", - "tests[postman.getGlobalVariable(\"service\")+\" exists\"] = service_found === true;", - "" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/serviceSpecification", - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "GET all service instances via ServiceInventory API", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", - "var service_instance_found = false;", - "for (var i = 0; i < jsonData.length; i++) { ", - " if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {", - " service_instance_found = true;", - " }", - "}", - "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;" - ] - } - } - ], - "request": { - "url": { - "raw": "{{url-nbi}}/nbi/api/v3/service?relatedParty.id={{customer_name}}", - "host": [ - "{{url-nbi}}" - ], - "path": [ - "nbi", - "api", - "v3", - "service" - ], - "query": [ - { - "key": "relatedParty.id", - "value": "{{customer_name}}", - "equals": true, - "description": "" - } - ], - "variable": [] - }, - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "Add service instance via ServiceOrder API", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 201\"] = responseCode.code === 201;", - "", - "var jsonData = JSON.parse(responseBody);", - "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", - "", - "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);", - " " - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/serviceOrder", - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "description": "" - }, - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "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}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "GET previous serviceOrder", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "", - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", - "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");", - "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";", - "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";", - "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");", - "" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/serviceOrder/{{auto_service_order_id}}", - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "description": "" - }, - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "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}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "GET created service instance in inventory", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "", - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "", - "" - ] - } - } - ], - "request": { - "url": { - "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", - "host": [ - "{{url-nbi}}" - ], - "path": [ - "nbi", - "api", - "v3", - "service", - "{{auto_service_instance_id}}" - ], - "query": [ - { - "key": "relatedParty.id", - "value": "{{customer_name}}", - "equals": true, - "description": "" - }, - { - "key": "serviceSpecification.name", - "value": "{{service}}", - "equals": true, - "description": "" - } - ], - "variable": [] - }, - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "Delete service Instance via ServiceOrder API", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 201\"] = responseCode.code === 201;", - "", - "var jsonData = JSON.parse(responseBody);", - "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);", - "", - "", - "", - "" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/serviceOrder", - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "description": "" - }, - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "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}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "DELAY 10s", - "request": { - "url": "https://postman-echo.com/delay/10", - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "description": "" - }, - "response": [] - }, - { - "name": "GET previous serviceOrder", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "", - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", - "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");", - "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";", - "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";", - "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");", - "" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/serviceOrder/{{auto_service_order_id}}", - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "description": "" - }, - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "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}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "GET service instance in inventory (should no longer exists)", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "", - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "", - "" - ] - } - } - ], - "request": { - "url": { - "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", - "host": [ - "{{url-nbi}}" - ], - "path": [ - "nbi", - "api", - "v3", - "service", - "{{auto_service_instance_id}}" - ], - "query": [ - { - "key": "relatedParty.id", - "value": "{{customer_name}}", - "equals": true, - "description": "" - }, - { - "key": "serviceSpecification.name", - "value": "{{service}}", - "equals": true, - "description": "" - } - ], - "variable": [] - }, - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "GET all service instance via ServiceInventory API", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "", - "", - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "var jsonData = JSON.parse(responseBody);", - "var service_instance_found = false;", - "for (var i = 0; i < jsonData.length; i++) { ", - " if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {", - " service_instance_found = true;", - " }", - "}", - "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;" - ] - } - } - ], - "request": { - "url": { - "raw": "{{url-nbi}}/nbi/api/v3/service?relatedParty.id={{customer_name}}", - "host": [ - "{{url-nbi}}" - ], - "path": [ - "nbi", - "api", - "v3", - "service" - ], - "query": [ - { - "key": "relatedParty.id", - "value": "{{customer_name}}", - "equals": true, - "description": "" - } - ], - "variable": [] - }, - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - }, - { - "name": "GET hubs", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "" - ] - } - } - ], - "request": { - "url": "{{url-nbi}}/nbi/api/v3/hub", - "method": "GET", - "header": [], - "body": {}, - "description": "" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/test/postman/10_Service_Order.postman_collection.json b/test/postman/10_Service_Order.postman_collection.json new file mode 100644 index 000000000..0903b1a3c --- /dev/null +++ b/test/postman/10_Service_Order.postman_collection.json @@ -0,0 +1,494 @@ +{ + "variables": [], + "info": { + "name": "10_Service_Order", + "_postman_id": "28bdf2bb-4886-b8e7-45e3-eac832efc757", + "description": "", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" + }, + "item": [ + { + "name": "GET ExternalAPI-NBI component Status (HealthCheck)", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "tests[\"status\"] = jsonData.status === \"ok\";" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/status", + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "GET all service models from Service Catalog API", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "var service_found = false;", + "for (var i = 0; i < jsonData.length; i++) { ", + " if (jsonData[i].name === postman.getGlobalVariable(\"service\")) {", + " service_found = true;", + " postman.setGlobalVariable(\"auto_service_id\", \"\"+jsonData[i].id+\"\");", + " }", + "}", + "tests[postman.getGlobalVariable(\"service\")+\" exists\"] = service_found === true;", + "" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/serviceSpecification", + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "GET all service instances via ServiceInventory API", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "var service_instance_found = false;", + "for (var i = 0; i < jsonData.length; i++) { ", + " if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {", + " service_instance_found = true;", + " }", + "}", + "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;" + ] + } + } + ], + "request": { + "url": { + "raw": "{{url-nbi}}/nbi/api/v3/service?relatedParty.id={{customer_name}}", + "host": [ + "{{url-nbi}}" + ], + "path": [ + "nbi", + "api", + "v3", + "service" + ], + "query": [ + { + "key": "relatedParty.id", + "value": "{{customer_name}}", + "equals": true, + "description": "" + } + ], + "variable": [] + }, + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "Add service instance via ServiceOrder API", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 201\"] = responseCode.code === 201;", + "", + "var jsonData = JSON.parse(responseBody);", + "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", + "", + "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);", + " " + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/serviceOrder", + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "description": "" + }, + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "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}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "GET previous serviceOrder", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "", + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", + "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");", + "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";", + "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";", + "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");", + "" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/serviceOrder/{{auto_service_order_id}}", + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "description": "" + }, + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "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}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "GET created service instance in inventory", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "", + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "" + ] + } + } + ], + "request": { + "url": { + "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", + "host": [ + "{{url-nbi}}" + ], + "path": [ + "nbi", + "api", + "v3", + "service", + "{{auto_service_instance_id}}" + ], + "query": [ + { + "key": "relatedParty.id", + "value": "{{customer_name}}", + "equals": true, + "description": "" + }, + { + "key": "serviceSpecification.name", + "value": "{{service}}", + "equals": true, + "description": "" + } + ], + "variable": [] + }, + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "Delete service Instance via ServiceOrder API", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 201\"] = responseCode.code === 201;", + "", + "var jsonData = JSON.parse(responseBody);", + "postman.setGlobalVariable(\"auto_service_order_id\", jsonData.id);", + "", + "", + "", + "" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/serviceOrder", + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "description": "" + }, + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "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}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "DELAY 10s", + "request": { + "url": "https://postman-echo.com/delay/10", + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "description": "" + }, + "response": [] + }, + { + "name": "GET previous serviceOrder", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "", + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[postman.getGlobalVariable(\"externalId\")+\" exists\"] = jsonData.externalId === postman.getGlobalVariable(\"externalId\");", + "tests[\"service_order_id exists\"] = jsonData.id === postman.getGlobalVariable(\"auto_service_order_id\");", + "tests[\"service Order state is COMPLETED\"] = jsonData.state === \"COMPLETED\";", + "tests[\"Service Instance state is ACTIVE\"] = jsonData.orderItem[0].service.serviceState === \"active\";", + "postman.setGlobalVariable(\"auto_service_instance_id\", \"\"+jsonData.orderItem[0].service.id+\"\");", + "" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/serviceOrder/{{auto_service_order_id}}", + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "description": "" + }, + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "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}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "GET service instance in inventory (should no longer exists)", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "", + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "" + ] + } + } + ], + "request": { + "url": { + "raw": "{{url-nbi}}/nbi/api/v3/service/{{auto_service_instance_id}}?relatedParty.id={{customer_name}}&serviceSpecification.name={{service}}", + "host": [ + "{{url-nbi}}" + ], + "path": [ + "nbi", + "api", + "v3", + "service", + "{{auto_service_instance_id}}" + ], + "query": [ + { + "key": "relatedParty.id", + "value": "{{customer_name}}", + "equals": true, + "description": "" + }, + { + "key": "serviceSpecification.name", + "value": "{{service}}", + "equals": true, + "description": "" + } + ], + "variable": [] + }, + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "GET all service instance via ServiceInventory API", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "", + "", + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "var service_instance_found = false;", + "for (var i = 0; i < jsonData.length; i++) { ", + " if (jsonData[i].name === postman.getGlobalVariable(\"service_instance_name\")) {", + " service_instance_found = true;", + " }", + "}", + "tests[postman.getGlobalVariable(\"service_instance_name\")+\" does not exist\"] = service_instance_found === false;" + ] + } + } + ], + "request": { + "url": { + "raw": "{{url-nbi}}/nbi/api/v3/service?relatedParty.id={{customer_name}}", + "host": [ + "{{url-nbi}}" + ], + "path": [ + "nbi", + "api", + "v3", + "service" + ], + "query": [ + { + "key": "relatedParty.id", + "value": "{{customer_name}}", + "equals": true, + "description": "" + } + ], + "variable": [] + }, + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "GET hubs", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "" + ] + } + } + ], + "request": { + "url": "{{url-nbi}}/nbi/api/v3/hub", + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/test/postman/README.md b/test/postman/README.md new file mode 100644 index 000000000..86a797b8f --- /dev/null +++ b/test/postman/README.md @@ -0,0 +1,68 @@ +# Postman Collections + +## Description + +That repository contains 9 Postman collections and 2 environment files. + +They have been tested with Onap Casablanca (they are not compatible with + Beijing, and there is not guaranty about ONAP "master" as API definition + can change) + +You first need to import all those files into your Postman. +![postman](./images/import.png) + +And you should see all the collections +![postman](./images/collections.png) + +Each collection is made of several API operations +![postman](./images/collection-detail.png) + +Running all those collections, in the order, from 1 to 8 will create a lot of +objects in ONAP components : + +- SDC : vendor, VSP, zip file upload, VF from VSP, Service, add VF to Service +- VID : OwningEntity, LineOfBusiness, Project, Platform +- AAI : customer, subscription, cloud region, tenant +- NBI : serviceOrder to add a service instance, serviceOrder to delete a service + instance + +The order is very important because a lot of API request will need the API + response from the previous operation. +![postman](./images/collection-detail-test.png) + +It is possible to run the complete collection. +![postman](./images/run.png) + +You need, a zip file that contains Heat files for a VNF. + +Collection 3 is about uploading that file into ONAP SDC. +![postman](./images/zipfile.png) + +Before running those collections, once in Postman, you need to have a look +at "globals" environment parameters. +![postman](./images/globals.png) + +All variables that begin by "auto_" must not be change (they will be modified + using API response) +All other variables must be adapted to your needs. +In particular, you need to put your own values for cloud_region_id, tenant_name + and tenant_id to fit with the place where you will instantiate the VNF + +```yaml + service:freeradius + vf_name:integration_test_VF_freeradius + vsp_name:integration_test_VSP + vendor_name:onap_integration_vendor + owning_entity:integration_test_OE + platform:integration_test_platform + project:integration_test_project + lineofbusiness:integration_test_LOB + customer_name:generic + cloud_owner_name:OPNFV + cloud_region_id:RegionOne + tenant_name:openlab-vnfs + tenant_id:234a9a2dc4b643be9812915b214cdbbb + externalId:integration_test_BSS-001 + service_instance_name:integration_test_freeradius_instance_001 + listener_url:http://10.4.2.65:8080/externalapi/listener/v1/listener +``` diff --git a/test/postman/globals.postman_globals.json b/test/postman/globals.postman_globals.json index d8040d69b..91c384537 100644 --- a/test/postman/globals.postman_globals.json +++ b/test/postman/globals.postman_globals.json @@ -1,5 +1,5 @@ { - "id": "840dff41-02b1-d25c-166d-2d2e34f090de", + "id": "eefacaa7-254c-3fc7-f946-b7d87508e343", "name": "Postman Globals", "values": [ { @@ -59,7 +59,7 @@ }, { "key": "cloud_owner_name", - "value": "CloudOwner", + "value": "OPNFV", "description": "", "type": "text", "enabled": true @@ -228,6 +228,6 @@ } ], "_postman_variable_scope": "globals", - "_postman_exported_at": "2019-01-24T16:48:52.023Z", + "_postman_exported_at": "2019-01-25T07:54:33.611Z", "_postman_exported_using": "Postman/5.5.4" } \ No newline at end of file diff --git a/test/postman/images/collection-detail-test.png b/test/postman/images/collection-detail-test.png new file mode 100755 index 000000000..b64cd7ffa Binary files /dev/null and b/test/postman/images/collection-detail-test.png differ diff --git a/test/postman/images/collection-detail.png b/test/postman/images/collection-detail.png new file mode 100755 index 000000000..59b7db266 Binary files /dev/null and b/test/postman/images/collection-detail.png differ diff --git a/test/postman/images/collections.png b/test/postman/images/collections.png new file mode 100755 index 000000000..4469cdb9d Binary files /dev/null and b/test/postman/images/collections.png differ diff --git a/test/postman/images/globals.png b/test/postman/images/globals.png new file mode 100755 index 000000000..f3ae23978 Binary files /dev/null and b/test/postman/images/globals.png differ diff --git a/test/postman/images/import.png b/test/postman/images/import.png new file mode 100755 index 000000000..122c867ce Binary files /dev/null and b/test/postman/images/import.png differ diff --git a/test/postman/images/run.png b/test/postman/images/run.png new file mode 100755 index 000000000..35c4d5b1f Binary files /dev/null and b/test/postman/images/run.png differ diff --git a/test/postman/images/zipfile.png b/test/postman/images/zipfile.png new file mode 100755 index 000000000..a7cfa89ea Binary files /dev/null and b/test/postman/images/zipfile.png differ -- cgit 1.2.3-korg