Commit 026b4df4 authored by Pelayo Torres's avatar Pelayo Torres
Browse files

New Requests

parent 945d7d9c
Loading
Loading
Loading
Loading
+378 −4
Original line number Diff line number Diff line
{
	"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
+10 −4
Original line number Diff line number Diff line
{
	"id": "adb492cf-1d02-4a7c-a4a2-00cb54c202f1",
	"name": "CAPIF ENVIRONMENT",
	"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
−8.28 KiB (12.3 KiB)

File changed.

No diff preview for this file type.

+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ npm i
node script.js
```

3. Import Postman collection and environment variables (<a href="./CAPIF.postman_collection.json" download>CAPIF.postman_collection.json</a> and <a href="./CAPIF.postman_environment.json" download>CAPIF.postman_environment.json</a>)
3. Import Postman collection and environment variables (<a href="./CAPIF.postman_collection.json" download>CAPIF.postman_collection.json</a> and <a href="./CAPIF_ENVIRONMENTS.postman_environment.json" download>CAPIF.postman_environment.json</a>)
4. Select CAPIF Environment before start testing.
5. Install the necessary dependencies from requirements.txt using the following command: