diff --git a/doc/testing/postman/CAPIF.postman_collection.json b/doc/testing/postman/CAPIF.postman_collection.json index e59a534c9944eaf505d07188267adac75557df54..400f773037cf73f744cbfae31556bf5d912ef4ab 100644 --- a/doc/testing/postman/CAPIF.postman_collection.json +++ b/doc/testing/postman/CAPIF.postman_collection.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "b512e528-4b13-4be2-aed2-a61a8381360e", + "_postman_id": "5fe9117c-4ab3-4170-b7f0-6ac0e08e3320", "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-b512e528-4b13-4be2-aed2-a61a8381360e?action=share&source=collection_link&creator=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" }, "item": [ { @@ -251,7 +251,7 @@ } ], "protocolProfileBehavior": { - "strictSSL": true + "strictSSL": false }, "request": { "auth": { @@ -283,11 +283,12 @@ } }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/{{ONBOARDING_URL}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/{{ONBOARDING_URL}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "{{ONBOARDING_URL}}" ] @@ -320,7 +321,8 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -329,7 +331,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -351,7 +354,7 @@ ], "body": { "mode": "raw", - "raw": "\n{\n \"apiName\": \"hello_api_demo_v2\",\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 }", + "raw": "\n{\n \"apiName\": \"hello_api_demo_v2\",\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 }", "options": { "raw": { "language": "json" @@ -359,11 +362,12 @@ } }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/published-apis/v1/{{APF_ID}}/service-apis", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/published-apis/v1/{{APF_ID}}/service-apis", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "published-apis", "v1", @@ -461,11 +465,12 @@ } }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/{{ONBOARDING_URL_INVOKER}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/{{ONBOARDING_URL_INVOKER}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "{{ONBOARDING_URL_INVOKER}}" ] @@ -498,7 +503,8 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -518,7 +524,8 @@ " });", "}" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -549,11 +556,12 @@ } }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/{{DISCOVER_URL}}{{INVOKER_ID}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/{{DISCOVER_URL}}{{INVOKER_ID}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "{{DISCOVER_URL}}{{INVOKER_ID}}" ] @@ -586,7 +594,8 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -595,7 +604,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -617,7 +627,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"securityInfo\": [\n {\n \"prefSecurityMethods\": [\n \"Oauth\"\n ],\n \"authenticationInfo\": \"string\",\n \"authorizationInfo\": \"string\",\n \"aefId\": \"{{API_AEF_ID}}\",\n \"apiId\": \"{{API_SERVICE_ID}}\"\n }\n ],\n \"notificationDestination\": \"https://mynotificationdest.com\",\n \"requestTestNotification\": true,\n \"websockNotifConfig\": {\n \"websocketUri\": \"string\",\n \"requestWebsocketUri\": true\n },\n \"supportedFeatures\": \"fff\"\n}", + "raw": "{\n \"securityInfo\": [\n {\n \"prefSecurityMethods\": [\n \"OAUTH\"\n ],\n \"authenticationInfo\": \"string\",\n \"authorizationInfo\": \"string\",\n \"aefId\": \"{{API_AEF_ID}}\",\n \"apiId\": \"{{API_SERVICE_ID}}\"\n }\n ],\n \"notificationDestination\": \"https://mynotificationdest.com\",\n \"requestTestNotification\": true,\n \"websockNotifConfig\": {\n \"websocketUri\": \"string\",\n \"requestWebsocketUri\": true\n },\n \"supportedFeatures\": \"fff\"\n}", "options": { "raw": { "language": "json" @@ -625,11 +635,12 @@ } }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/capif-security/v1/trustedInvokers/{{INVOKER_ID}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/capif-security/v1/trustedInvokers/{{INVOKER_ID}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "capif-security", "v1", @@ -665,7 +676,8 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -677,7 +689,8 @@ " pm.environment.set('NETAPP_SERVICE_TOKEN', res.access_token);", "}" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -724,11 +737,12 @@ ] }, "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/capif-security/v1/securities/{{INVOKER_ID}}/token", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/capif-security/v1/securities/{{INVOKER_ID}}/token", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "capif-security", "v1", @@ -789,7 +803,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"name\": {{USER_NAME}}\n}", + "raw": "{\n\"name\": \"{{USER_NAME}}\"\n}", "options": { "raw": { "language": "json" @@ -829,7 +843,8 @@ " });", " }, 5000);" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -843,11 +858,12 @@ "method": "DELETE", "header": [], "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/{{ONBOARDING_URL}}/{{PROVIDER_ID}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/{{ONBOARDING_URL}}/{{PROVIDER_ID}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "{{ONBOARDING_URL}}", "{{PROVIDER_ID}}" @@ -878,7 +894,8 @@ " });", " }, 5000);" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -892,11 +909,12 @@ "method": "DELETE", "header": [], "url": { - "raw": "https://{{CAPIF_HOSTNAME}}/{{ONBOARDING_URL_INVOKER}}/{{INVOKER_ID}}", + "raw": "https://{{CAPIF_HOSTNAME}}:{{CAPIF_PORT}}/{{ONBOARDING_URL_INVOKER}}/{{INVOKER_ID}}", "protocol": "https", "host": [ "{{CAPIF_HOSTNAME}}" ], + "port": "{{CAPIF_PORT}}", "path": [ "{{ONBOARDING_URL_INVOKER}}", "{{INVOKER_ID}}" diff --git a/doc/testing/postman/CAPIF.postman_environment.json b/doc/testing/postman/CAPIF.postman_environment.json index 0ed42a99d3ea99166344b178c3fa78419f12be43..7d08cfa503506cbdaa6b452edba691625cd6e57f 100644 --- a/doc/testing/postman/CAPIF.postman_environment.json +++ b/doc/testing/postman/CAPIF.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "872bffef-37ef-4a25-afa8-6a61de256f4b", + "id": "7111197e-e9c8-4988-a519-3284ab9021a9", "name": "CAPIF", "values": [ { @@ -10,7 +10,7 @@ }, { "key": "CAPIF_PORT", - "value": "8080", + "value": "443", "type": "default", "enabled": true }, @@ -262,6 +262,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2024-06-26T11:17:13.183Z", - "_postman_exported_using": "Postman/11.2.13" + "_postman_exported_at": "2024-07-30T07:59:01.623Z", + "_postman_exported_using": "Postman/11.3.2" } \ No newline at end of file diff --git a/doc/testing/postman/Postman-Test.zip b/doc/testing/postman/Postman-Test.zip new file mode 100644 index 0000000000000000000000000000000000000000..41f2d883b35b29556fed958f017b78731158c423 Binary files /dev/null and b/doc/testing/postman/Postman-Test.zip differ diff --git a/doc/testing/postman/README.md b/doc/testing/postman/README.md index e73dab64c1b0c63e111136e26bda66f66ed60d15..6729fb0e9aa51187f58dd657036dc61ae75c07b7 100644 --- a/doc/testing/postman/README.md +++ b/doc/testing/postman/README.md @@ -1,5 +1,6 @@ # Postman -In this section we can use Postman to publish an API as a provider and use it as an invoker. + +This section shows how OpenCAPIF is used through requests made with Postman, from the creation of a provider together with the publication of an api, to the creation of an invoker and the consumption of the published api. Everything you need to run the test is in Postman-Test.zip. ## Requisites @@ -14,7 +15,7 @@ In this section we can use Postman to publish an API as a provider and use it as npm i ``` -1. Run the script.js with the following command: +2. Run the script.js with the following command: ``` node script.js @@ -22,6 +23,11 @@ node script.js 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: + +``` +pip install -r requirements.txt +``` ## Remote CAPIF @@ -67,6 +73,8 @@ The next step is to register a provider using the user created by the administra ![Flow](../../images/flows/04_AEF_API_Provider_registration.png) +#### **05-publish_api** + At this point we move on to using certificate authentication in CAPIF. In Postman it is necessary to add the certificates manually and using more than one certificate for the same host as we do in CAPIF complicates things. For this reason, we use the script to overwrite a certificate and a key when it is necessary to have a specific one. To configure go to **settings** in Postman and open the **certificates** section. @@ -77,8 +85,6 @@ To configure go to **settings** in Postman and open the **certificates** section Once this is done, the node script will be in charge of changing the certificate that is necessary in each request. -#### **05-publish_api** - ![Flow](../../images/flows/05_AEF_Publish.png) Once the api is published, we can start it. In this case we have a test one created in python called hello_api.py that can be executed with the following command: @@ -103,10 +109,10 @@ Finally, we will create an invoker with the user given by the administrator to b ![Flow](../../images/flows/07_Invoker_Onboarding.png) -At this point we move on to using certificate authentication in CAPIF. **If you did not configure the provider's certificates, you would have to do it now**. - #### **08-discover** +At this point we move on to using certificate authentication in CAPIF. **If you did not configure the provider's certificates, you would have to do it now**. + ![Flow](../../images/flows/08_Invoker_Discover_AEF.png) #### **09-security_context** diff --git a/doc/testing/postman/requirements.txt b/doc/testing/postman/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6e4396101ec6bf6fabd13cc42e479c596f40714 --- /dev/null +++ b/doc/testing/postman/requirements.txt @@ -0,0 +1,4 @@ +Flask == 3.0.3 +flask_jwt_extended == 4.6.0 +pyopenssl == 24.1.0 +pyone \ No newline at end of file