diff --git a/doc/testing/postman/CAPIF.postman_collection.json b/doc/testing/postman/CAPIF.postman_collection.json index f1ce8404dcf052e5c8677cd3df90d8eed1c1ebac..eab0e7b6b43072f136fc298dc7ae0d4aef311a16 100644 --- a/doc/testing/postman/CAPIF.postman_collection.json +++ b/doc/testing/postman/CAPIF.postman_collection.json @@ -1,10 +1,9 @@ { "info": { - "_postman_id": "5fe9117c-4ab3-4170-b7f0-6ac0e08e3320", + "_postman_id": "7b685345-a379-40f5-8740-ad92d38d1750", "name": "CAPIF", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "31608242", - "_collection_link": "https://red-comet-993867.postman.co/workspace/Team-Workspace~bfc7c442-a60c-4bb1-8730-fdabc2df89b9/collection/31608242-5fe9117c-4ab3-4170-b7f0-6ac0e08e3320?action=share&source=collection_link&creator=31608242" + "_exporter_id": "31608242" }, "item": [ { @@ -363,7 +362,7 @@ ], "body": { "mode": "raw", - "raw": "\n{\n \"apiName\": \"hello_api_demo_v6\",\n \"aefProfiles\": [\n {\n \"aefId\": \"{{AEF_ID}}\",\n \"versions\": [\n {\n \"apiVersion\": \"v1\",\n \"expiry\": \"2021-11-30T10:32:02.004Z\",\n \"resources\": [\n {\n \"resourceName\": \"hello-endpoint\",\n \"commType\": \"REQUEST_RESPONSE\",\n \"uri\": \"/hello\",\n \"custOpName\": \"string\",\n \"operations\": [\n \"POST\"\n ],\n \"description\": \"Endpoint to receive a welcome message\"\n }\n ],\n \"custOperations\": [\n {\n \"commType\": \"REQUEST_RESPONSE\",\n \"custOpName\": \"string\",\n \"operations\": [\n \"POST\"\n ],\n \"description\": \"string\"\n }\n ]\n }\n ],\n \"protocol\": \"HTTP_1_1\",\n \"dataFormat\": \"JSON\",\n \"securityMethods\": [\"OAUTH\"],\n \"interfaceDescriptions\": [\n {\n \"ipv4Addr\": \"localhost\",\n \"port\": 8088,\n \"securityMethods\": [\"OAUTH\"]\n }\n ]\n }\n ],\n \"description\": \"Hello api services\",\n \"supportedFeatures\": \"fffff\",\n \"shareableInfo\": {\n \"isShareable\": true,\n \"capifProvDoms\": [\n \"string\"\n ]\n },\n \"serviceAPICategory\": \"string\",\n \"apiSuppFeats\": \"fffff\",\n \"pubApiPath\": {\n \"ccfIds\": [\n \"string\"\n ]\n },\n \"ccfId\": \"string\",\n \"apiStatus\": {\n \"aefIds\": []\n }\n }", + "raw": "\n{\n \"apiName\": \"hello_api_demo\",\n \"aefProfiles\": [\n {\n \"aefId\": \"{{AEF_ID}}\",\n \"versions\": [\n {\n \"apiVersion\": \"v1\",\n \"expiry\": \"2021-11-30T10:32:02.004Z\",\n \"resources\": [\n {\n \"resourceName\": \"hello-endpoint\",\n \"commType\": \"REQUEST_RESPONSE\",\n \"uri\": \"/hello\",\n \"custOpName\": \"string\",\n \"operations\": [\n \"POST\"\n ],\n \"description\": \"Endpoint to receive a welcome message\"\n }\n ],\n \"custOperations\": [\n {\n \"commType\": \"REQUEST_RESPONSE\",\n \"custOpName\": \"string\",\n \"operations\": [\n \"POST\"\n ],\n \"description\": \"string\"\n }\n ]\n }\n ],\n \"protocol\": \"HTTP_1_1\",\n \"dataFormat\": \"JSON\",\n \"securityMethods\": [\"OAUTH\"],\n \"interfaceDescriptions\": [\n {\n \"ipv4Addr\": \"localhost\",\n \"port\": 8088,\n \"securityMethods\": [\"OAUTH\"]\n }\n ]\n }\n ],\n \"description\": \"Hello api services\",\n \"supportedFeatures\": \"fffff\",\n \"shareableInfo\": {\n \"isShareable\": true,\n \"capifProvDoms\": [\n \"string\"\n ]\n },\n \"serviceAPICategory\": \"string\",\n \"apiSuppFeats\": \"fffff\",\n \"pubApiPath\": {\n \"ccfIds\": [\n \"string\"\n ]\n },\n \"ccfId\": \"string\",\n \"apiStatus\":{\n \"aefIds\": [\n \"{{AEF_ID}}\"\n ]\n }\n }", "options": { "raw": { "language": "json" @@ -1013,6 +1012,381 @@ } }, "response": [] + }, + { + "name": "provider_events", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {", + " pm.sendRequest({", + " url: 'http://'+ pm.environment.get(\"NODE_HOSTNAME\") + ':'+ pm.environment.get(\"NODE_PORT\")+'/write_cert',", + " method: 'POST',", + " header: 'Content-Type:application/json',", + " encoding: 'binary',", + " body: {", + " mode: 'raw',", + " raw: {cert: pm.environment.get('AMF_CERT'), key:pm.environment.get('AMF_KEY')}", + " }", + " }, function (err, response) {", + " console.log(response)", + " });", + " }, 5000);" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var res = JSON.parse(responseBody);", + "if (pm.response.code == 201){", + " ", + " let locationHeader = pm.response.headers.get(\"location\");", + "", + " if (locationHeader) {", + " let match = locationHeader.match(/\\/([^\\/]+)$/);", + " ", + " if (match) {", + " pm.environment.set(\"EVENTS_ID\", match[1]);", + " } else {", + " console.log(\"No ID found in the URL\");", + " }", + " } else {", + " console.log(\"The 'location' header is not present in the response\");", + " }", + "", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"events\": [\n \"SERVICE_API_AVAILABLE\",\n \"SERVICE_API_UNAVAILABLE\"\n ],\n \"notificationDestination\": \"http://host.docker.internal:2222/\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/capif-events/v1/{{AMF_ID}}/subscriptions", + "protocol": "https", + "host": [ + "{{CAPIF_HOSTNAME}}" + ], + "port": "{{CAPIF_PORT}}", + "path": [ + "capif-events", + "v1", + "{{AMF_ID}}", + "subscriptions" + ] + } + }, + "response": [] + }, + { + "name": "provider_update_events", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {", + " pm.sendRequest({", + " url: 'http://'+ pm.environment.get(\"NODE_HOSTNAME\") + ':'+ pm.environment.get(\"NODE_PORT\")+'/generate_csr',", + " method: 'POST',", + " header: 'Content-Type:application/json',", + " encoding: 'binary',", + " body: {", + " mode: 'raw',", + " raw: {cert: pm.environment.get('AMF_CERT'), key:pm.environment.get('AMF_KEY')}", + " }", + " }, function (err, response) {", + " console.log(response)", + " });", + " }, 5000);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"events\": [\n \"SERVICE_API_AVAILABLE\",\n \"SERVICE_API_UNAVAILABLE\"\n ],\n \"notificationDestination\": \"http://host.docker.internal:2222/\",\n \"supportedFeatures\":\"f\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/capif-events/v1/{{AMF_ID}}/subscriptions/{{EVENTS_ID}}", + "protocol": "https", + "host": [ + "{{CAPIF_HOSTNAME}}" + ], + "port": "{{CAPIF_PORT}}", + "path": [ + "capif-events", + "v1", + "{{AMF_ID}}", + "subscriptions", + "{{EVENTS_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "create_log", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {", + " pm.sendRequest({", + " url: 'http://'+ pm.environment.get(\"NODE_HOSTNAME\") + ':'+ pm.environment.get(\"NODE_PORT\")+'/write_cert',", + " method: 'POST',", + " header: 'Content-Type:application/json',", + " encoding: 'binary',", + " body: {", + " mode: 'raw',", + " raw: {cert: pm.environment.get('AEF_CERT'), key:pm.environment.get('AEF_KEY')}", + " }", + " }, function (err, response) {", + " console.log(response)", + " });", + " }, 5000);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"aefId\": \"{{AEF_ID}}\",\n \"apiInvokerId\": \"{{INVOKER_ID}}\",\n \"logs\":[\n {\n \"apiId\": \"{{API_ID}}\",\n \"apiName\": \"{{API_NAME}}\",\n \"apiVersion\": \"v1\",\n \"resourceName\": \"hello-endpoint\",\n \"uri\": \"/hello\",\n \"protocol\": \"HTTP_1_1\",\n \"operation\": \"POST\",\n \"result\": \"200\",\n \"invocationTime\": \"2023-03-30T10:30:21.408000+00:00\",\n \"invocationLatency\": 0,\n \"inputParameters\": \"string\",\n \"outputParameters\": \"string\",\n \"srcInterface\": {\n \"ipv4Addr\": \"localhost\",\n \"port\": 8088,\n \"securityMethods\": [\n \"OAUTH\"\n ]\n },\n \"destInterface\": {\n \"ipv4Addr\": \"localhost\",\n \"port\": 8089,\n \"securityMethods\": [\n \"OAUTH\"\n ]\n },\n \"fwdInterface\": \"string\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/api-invocation-logs/v1/{{AEF_ID}}/logs", + "protocol": "https", + "host": [ + "{{CAPIF_HOSTNAME}}" + ], + "port": "{{CAPIF_PORT}}", + "path": [ + "api-invocation-logs", + "v1", + "{{AEF_ID}}", + "logs" + ] + } + }, + "response": [] + }, + { + "name": "get_log", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {", + " pm.sendRequest({", + " url: 'http://'+ pm.environment.get(\"NODE_HOSTNAME\") + ':'+ pm.environment.get(\"NODE_PORT\")+'/write_cert',", + " method: 'POST',", + " header: 'Content-Type:application/json',", + " encoding: 'binary',", + " body: {", + " mode: 'raw',", + " raw: {cert: pm.environment.get('AEF_CERT'), key:pm.environment.get('AEF_KEY')}", + " }", + " }, function (err, response) {", + " console.log(response)", + " });", + " }, 5000);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/logs/v1/apiInvocationLogs?aef-id={{AEF_ID}}&api-invoker-id={{INVOKER_ID}}", + "protocol": "https", + "host": [ + "{{CAPIF_HOSTNAME}}" + ], + "port": "{{CAPIF_PORT}}", + "path": [ + "logs", + "v1", + "apiInvocationLogs" + ], + "query": [ + { + "key": "aef-id", + "value": "{{AEF_ID}}" + }, + { + "key": "api-invoker-id", + "value": "{{INVOKER_ID}}" + } + ] + } + }, + "response": [] + }, + { + "name": "get_acl", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {", + " pm.sendRequest({", + " url: 'http://'+ pm.environment.get(\"NODE_HOSTNAME\") + ':'+ pm.environment.get(\"NODE_PORT\")+'/write_cert',", + " method: 'POST',", + " header: 'Content-Type:application/json',", + " encoding: 'binary',", + " body: {", + " mode: 'raw',", + " raw: {cert: pm.environment.get('AEF_CERT'), key:pm.environment.get('AEF_KEY')}", + " }", + " }, function (err, response) {", + " console.log(response)", + " });", + " }, 5000);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/access-control-policy/v1/accessControlPolicyList/{{API_SERVICE_ID}}?aef-id={{AEF_ID}}&api-invoker-id={{INVOKER_ID}}", + "protocol": "https", + "host": [ + "{{CAPIF_HOSTNAME}}" + ], + "port": "{{CAPIF_PORT}}", + "path": [ + "access-control-policy", + "v1", + "accessControlPolicyList", + "{{API_SERVICE_ID}}" + ], + "query": [ + { + "key": "aef-id", + "value": "{{AEF_ID}}" + }, + { + "key": "api-invoker-id", + "value": "{{INVOKER_ID}}" + } + ] + } + }, + "response": [] } ] } \ No newline at end of file diff --git a/doc/testing/postman/CAPIF.postman_environment.json b/doc/testing/postman/CAPIF_ENVIRONMENTS.postman_environment.json similarity index 94% rename from doc/testing/postman/CAPIF.postman_environment.json rename to doc/testing/postman/CAPIF_ENVIRONMENTS.postman_environment.json index d9e1e599be8c185aeff26f1cbc1e4e3a16903d6d..efc8bdf6def8bdf8fdf1019da6047d31ad6a0811 100644 --- a/doc/testing/postman/CAPIF.postman_environment.json +++ b/doc/testing/postman/CAPIF_ENVIRONMENTS.postman_environment.json @@ -1,6 +1,6 @@ { - "id": "adb492cf-1d02-4a7c-a4a2-00cb54c202f1", - "name": "CAPIF Copy", + "id": "67e58f03-6bf2-4bcc-8353-c92906412e95", + "name": "CAPIF ENVIRONMENTS", "values": [ { "key": "CAPIF_HOSTNAME", @@ -271,9 +271,15 @@ "value": "", "type": "any", "enabled": true + }, + { + "key": "EVENTS_ID", + "value": "", + "type": "any", + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2024-10-07T09:27:29.742Z", - "_postman_exported_using": "Postman/11.12.0" + "_postman_exported_at": "2024-11-13T10:34:19.421Z", + "_postman_exported_using": "Postman/11.14.1" } \ No newline at end of file diff --git a/doc/testing/postman/Postman-Test.zip b/doc/testing/postman/Postman-Test.zip index a69a491dbf1aed153d6abe319d233828d33026a4..0f3d09d0d19e6156e03c59d4d07fa9c03aaa51b5 100644 Binary files a/doc/testing/postman/Postman-Test.zip and b/doc/testing/postman/Postman-Test.zip differ diff --git a/doc/testing/postman/README.md b/doc/testing/postman/README.md index 6729fb0e9aa51187f58dd657036dc61ae75c07b7..7fba2ad5a8cd8119c60e340427142248d196007d 100644 --- a/doc/testing/postman/README.md +++ b/doc/testing/postman/README.md @@ -21,7 +21,7 @@ npm i node script.js ``` -3. Import Postman collection and environment variables (CAPIF.postman_collection.json and CAPIF.postman_environment.json) +3. Import Postman collection and environment variables (CAPIF.postman_collection.json and CAPIF.postman_environment.json) 4. Select CAPIF Environment before start testing. 5. Install the necessary dependencies from requirements.txt using the following command: