From 95254e851c334a9569d33b664289cf9b0aba7a9e Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Mon, 23 Mar 2026 11:46:36 +0100 Subject: [PATCH 1/2] 2 new tests related with apiName improvement --- .../capif_api_publish_service.robot | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot b/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot index adc7f574..de994fe0 100644 --- a/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot +++ b/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot @@ -393,3 +393,135 @@ Check Two Published APIs with different APFs are removed when Provider is delete # ${services_removed}= Evaluate ${services_present_on_ccf_after_publish} - ${services_present_on_ccf_after_provider_deletion_superadmin} # Run Keyword And Continue On Failure Should Be Equal "${services_removed}" "2" msg=Not all services removed after delete provider (removed) vs (expected) + + +Publish API same apiName but different AEF + [Tags] capif_api_publish_service-15 smoke + + ${api_name}= Set Variable testing_robot_service_1 + + # Default Invoker Registration and Onboarding + ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding + + # Create Provider1 with 2 AEF roles and publish API + ${register_user_info_provider_1}= Provider Default Registration total_aef_roles=2 + ${aef_id_1}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']} + ${aef_id_2}= Set Variable + ... ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']} + ${aef_ids}= Create List ${aef_id_1} ${aef_id_2} + + ## Publish API service_1 with aefIds_1 + ${service_api_description_published_1_1} ${resource_url} ${request_body}= Publish Service Api + ... ${register_user_info_provider_1} + ... ${api_name} + ... aef_id=${aef_id_1} + + ## Publish API service_2 with aefIds_2 + ${service_api_description_published_1_2} ${resource_url} ${request_body}= Publish Service Api + ... ${register_user_info_provider_1} + ... ${api_name} + ... aef_id=${aef_id_2} + + # Create Provider2 with 1 AEF role and publish API + ${register_user_info_provider_2}= Provider Default Registration provider_username=${PROVIDER_USERNAME}_NEW + ${aef2_id_1}= Set Variable + ... ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']} + + ## Publish API service_2 with Provider2 + ${service_api_description_published_2} ${resource_url_2} ${request_body_2}= Publish Service Api + ... ${register_user_info_provider_2} + ... ${api_name} + ... aef_id=${aef2_id_1} + + # Check if there are 2 API published with same apiName but different AEFs + # Retrieve Services published + ${resp}= Get Request Capif + ... /published-apis/v1/${register_user_info_provider_1['apf_id']}/service-apis + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${APF_PROVIDER_USERNAME} + + Check Response Variable Type And Values ${resp} 200 ServiceAPIDescription + + List Should Contain Value ${resp.json()} ${service_api_description_published_1_1} + List Should Contain Value ${resp.json()} ${service_api_description_published_1_2} + + # Check if there are 3 API published with same apiName but different AEFs + # Discover API published + # Request all APIs for Invoker + ${resp}= Get Request Capif + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name} + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${INVOKER_USERNAME} + + Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs + + # Check returned values + Should Not Be Empty ${resp.json()['serviceAPIDescriptions']} + Length Should Be ${resp.json()['serviceAPIDescriptions']} 3 + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_1} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_2} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} + + + + +Publish API same apiName but different AEF + [Tags] capif_api_publish_service-16 smoke + + ${api_name}= Set Variable testing_robot_service_1 + + # Default Invoker Registration and Onboarding + ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding + + # Create Provider1 with 2 AEF roles and publish API + ${register_user_info_provider_1}= Provider Default Registration total_aef_roles=2 + ${aef_id_1}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']} + ${aef_id_2}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']} + ${aef_ids}= Create List ${aef_id_1} ${aef_id_2} + + + ${resp} ${request_body}= Publish Service Api Request ${register_user_info_provider_1} ${api_name} aef_id=${aef_id_1} + + Check Response Variable Type And Values ${resp} 201 ServiceAPIDescription + Dictionary Should Contain Key ${resp.json()} apiId + ${service_api_description_published_1_1}= Set Variable ${resp.json()} + + ${resp} ${request_body}= Publish Service Api Request ${register_user_info_provider_1} ${api_name} aef_id=${aef_id_1} + Check Response Variable Type And Values ${resp} 403 ProblemDetails + ... status=403 + ... title=Forbidden + ... detail=Already registered service with same api name and aef id + ... cause=Found service with same api name and aef id + + # Create Provider2 with 1 AEF role and publish API + ${register_user_info_provider_2}= Provider Default Registration provider_username=${PROVIDER_USERNAME}_NEW + ${aef2_id_1}= Set Variable + ... ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']} + + ## Publish API service_2 with Provider2 + ${service_api_description_published_2} ${resource_url_2} ${request_body_2}= Publish Service Api + ... ${register_user_info_provider_2} + ... ${api_name} + ... aef_id=${aef2_id_1} + + # Check if there are 2 API published with same apiName but different AEFs + # Discover API published + # Request all APIs for Invoker + ${resp}= Get Request Capif + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name} + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${INVOKER_USERNAME} + + Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs + + # Check returned values + Should Not Be Empty ${resp.json()['serviceAPIDescriptions']} + Length Should Be ${resp.json()['serviceAPIDescriptions']} 2 + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_1} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} + + + -- GitLab From 1b50ac5d2ed1b74d02decfd39a9a7d1ad59d4a89 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Mon, 23 Mar 2026 13:23:52 +0100 Subject: [PATCH 2/2] Improved test title for capif_api_publish_service 15 and 16 --- .../capif_api_publish_service.robot | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot b/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot index de994fe0..f871fbb0 100644 --- a/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot +++ b/tests/features/CAPIF Api Publish Service/capif_api_publish_service.robot @@ -398,6 +398,7 @@ Check Two Published APIs with different APFs are removed when Provider is delete Publish API same apiName but different AEF [Tags] capif_api_publish_service-15 smoke + # Set API name ${api_name}= Set Variable testing_robot_service_1 # Default Invoker Registration and Onboarding @@ -408,7 +409,6 @@ Publish API same apiName but different AEF ${aef_id_1}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']} ${aef_id_2}= Set Variable ... ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']} - ${aef_ids}= Create List ${aef_id_1} ${aef_id_2} ## Publish API service_1 with aefIds_1 ${service_api_description_published_1_1} ${resource_url} ${request_body}= Publish Service Api @@ -416,7 +416,7 @@ Publish API same apiName but different AEF ... ${api_name} ... aef_id=${aef_id_1} - ## Publish API service_2 with aefIds_2 + ## Publish API service_1 with aefIds_2 ${service_api_description_published_1_2} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider_1} ... ${api_name} @@ -427,68 +427,71 @@ Publish API same apiName but different AEF ${aef2_id_1}= Set Variable ... ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']} - ## Publish API service_2 with Provider2 + ## Publish API service_1 with Provider2 ${service_api_description_published_2} ${resource_url_2} ${request_body_2}= Publish Service Api ... ${register_user_info_provider_2} ... ${api_name} ... aef_id=${aef2_id_1} - # Check if there are 2 API published with same apiName but different AEFs - # Retrieve Services published + # Validation of final scenario. + ## Check if there are 2 API published with same apiName but different AEFs by retrieving all APIs for provider 1 using APF provider credentials + ### Retrieve Services published ${resp}= Get Request Capif ... /published-apis/v1/${register_user_info_provider_1['apf_id']}/service-apis ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${APF_PROVIDER_USERNAME} + ### Validate response and values obtained Check Response Variable Type And Values ${resp} 200 ServiceAPIDescription - + #### Check returned values List Should Contain Value ${resp.json()} ${service_api_description_published_1_1} List Should Contain Value ${resp.json()} ${service_api_description_published_1_2} - # Check if there are 3 API published with same apiName but different AEFs - # Discover API published - # Request all APIs for Invoker + ## Check if there are 3 API published with same apiName but different AEFs + ### Discover API published by retrieving all APIs for Invoker using Invoker credentials ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} + ### Validate response and values obtained Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs - - # Check returned values + #### Check returned values Should Not Be Empty ${resp.json()['serviceAPIDescriptions']} Length Should Be ${resp.json()['serviceAPIDescriptions']} 3 List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_1} List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_2} List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} - - - -Publish API same apiName but different AEF +Publish API same apiName and same AEF [Tags] capif_api_publish_service-16 smoke + # Set API name ${api_name}= Set Variable testing_robot_service_1 # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - # Create Provider1 with 2 AEF roles and publish API + # Create Provider1 with 2 AEF roles ${register_user_info_provider_1}= Provider Default Registration total_aef_roles=2 ${aef_id_1}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']} ${aef_id_2}= Set Variable ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']} ${aef_ids}= Create List ${aef_id_1} ${aef_id_2} - + ## Publish API service_1 with aefIds_1 ${resp} ${request_body}= Publish Service Api Request ${register_user_info_provider_1} ${api_name} aef_id=${aef_id_1} + ### Validate response and values obtained Check Response Variable Type And Values ${resp} 201 ServiceAPIDescription Dictionary Should Contain Key ${resp.json()} apiId ${service_api_description_published_1_1}= Set Variable ${resp.json()} + ## Publish API service_1 with aefIds_1, error expected since same apiName and same AEF ${resp} ${request_body}= Publish Service Api Request ${register_user_info_provider_1} ${api_name} aef_id=${aef_id_1} + + ### Validate error response and values obtained Check Response Variable Type And Values ${resp} 403 ProblemDetails ... status=403 ... title=Forbidden @@ -500,24 +503,24 @@ Publish API same apiName but different AEF ${aef2_id_1}= Set Variable ... ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']} - ## Publish API service_2 with Provider2 + ## Publish API service_1 with Provider2 aefid_1, since same apiName but different AEF, it should be published successfully ${service_api_description_published_2} ${resource_url_2} ${request_body_2}= Publish Service Api ... ${register_user_info_provider_2} ... ${api_name} ... aef_id=${aef2_id_1} - # Check if there are 2 API published with same apiName but different AEFs - # Discover API published - # Request all APIs for Invoker + # Validation of final scenario. + ## Check if there are 2 API published with same apiName but different AEFs + ### Discover API published by retrieving all APIs for Invoker using Invoker credentials ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} + ### Validate response and values obtained Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs - - # Check returned values + #### Check returned values Should Not Be Empty ${resp.json()['serviceAPIDescriptions']} Length Should Be ${resp.json()['serviceAPIDescriptions']} 2 List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1_1} -- GitLab