From 2d9f55e170b788365f89444bb04413c820723a7d Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 17 Apr 2024 12:11:37 +0200 Subject: [PATCH 1/3] Update Robot tests with latest changes --- .../capif_security_api.robot | 18 +-- tests/libraries/helpers.py | 13 ++ tests/requirements.txt | 3 +- tests/resources/common/basicRequests.robot | 68 ++++++++-- tests/tasks/Dummy Info/__init__.robot | 2 + tests/tasks/Dummy Info/populate.robot | 126 ++++++++++++++++++ tests/tasks/__init__.robot | 56 ++++++++ 7 files changed, 265 insertions(+), 21 deletions(-) create mode 100644 tests/tasks/Dummy Info/__init__.robot create mode 100644 tests/tasks/Dummy Info/populate.robot create mode 100644 tests/tasks/__init__.robot diff --git a/tests/features/CAPIF Security Api/capif_security_api.robot b/tests/features/CAPIF Security Api/capif_security_api.robot index 2a41e80..c920d01 100644 --- a/tests/features/CAPIF Security Api/capif_security_api.robot +++ b/tests/features/CAPIF Security Api/capif_security_api.robot @@ -670,7 +670,7 @@ Retrieve access token # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -729,7 +729,7 @@ Retrieve access token by Provider # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -787,7 +787,7 @@ Retrieve access token by Provider with invalid apiInvokerId # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -846,7 +846,7 @@ Retrieve access token with invalid apiInvokerId # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -907,7 +907,7 @@ Retrieve access token with invalid client_id # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -966,7 +966,7 @@ Retrieve access token with unsupported grant_type # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -1032,7 +1032,7 @@ Retrieve access token with invalid scope # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -1093,7 +1093,7 @@ Retrieve access token with invalid aefid at scope # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} @@ -1154,7 +1154,7 @@ Retrieve access token with invalid apiName at scope # Test ${discover_response}= Get Request Capif - ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} diff --git a/tests/libraries/helpers.py b/tests/libraries/helpers.py index ec1abe0..94c850f 100644 --- a/tests/libraries/helpers.py +++ b/tests/libraries/helpers.py @@ -7,6 +7,8 @@ from OpenSSL.crypto import (dump_certificate_request, dump_privatekey, from OpenSSL.SSL import FILETYPE_PEM import socket import copy +import json +import pickle def parse_url(input): @@ -139,3 +141,14 @@ def create_scope(aef_id, api_name): data = "3gpp#" + aef_id + ":" + api_name return data + +def read_dictionary(file_path): + with open(file_path, 'rb') as fp: + data = pickle.load(fp) + print('Dictionary loaded') + return data + +def write_dictionary(file_path, data): + with open(file_path, 'wb') as fp: + pickle.dump(data, fp) + print('dictionary saved successfully to file ' + file_path) diff --git a/tests/requirements.txt b/tests/requirements.txt index 71b55e2..c6d9032 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,4 +4,5 @@ requests==2.28.1 configparser==5.3.0 redis==4.3.4 rfc3987==1.3.8 -robotframework-httpctrl \ No newline at end of file +robotframework-httpctrl +robotframework-archivelibrary == 0.4.2 \ No newline at end of file diff --git a/tests/resources/common/basicRequests.robot b/tests/resources/common/basicRequests.robot index 1d8d695..580c7d0 100644 --- a/tests/resources/common/basicRequests.robot +++ b/tests/resources/common/basicRequests.robot @@ -332,12 +332,6 @@ Get Auth For User RETURN ${resp.json()} -# Clean Test Information By HTTP Requests -# Create Session jwtsession ${CAPIF_HTTP_URL} verify=True - -# ${resp}= DELETE On Session jwtsession /testdata -# Should Be Equal As Strings ${resp.status_code} 200 - Clean Test Information ${capif_users_dict}= Call Method ${CAPIF_USERS} get_capif_users_dict @@ -413,17 +407,38 @@ Remove entity Log Dictionary ${capif_users_dict} Log List ${register_users} +Remove Resource + [Arguments] ${resource_url} ${management_cert} ${username} + + ${resp}= Delete Request Capif + ... ${resource_url} + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${management_cert} + + Status Should Be 204 ${resp} + + &{body}= Create Dictionary + ... password=password + ... username=${username} + + Create Session jwtsession ${CAPIF_HTTPS_REGISTER_URL} verify=False disable_warnings=1 + + ${resp}= DELETE On Session jwtsession /remove json=${body} + + Should Be Equal As Strings ${resp.status_code} 204 + Invoker Default Onboarding [Arguments] ${invoker_username}=${INVOKER_USERNAME} ${register_user_info}= Register User At Jwt Auth - ... username=${INVOKER_USERNAME} role=${INVOKER_ROLE} + ... username=${invoker_username} role=${INVOKER_ROLE} # Send Onboarding Request ${request_body}= Create Onboarding Notification Body ... http://${CAPIF_CALLBACK_IP}:${CAPIF_CALLBACK_PORT}/netapp_callback ... ${register_user_info['csr_request']} - ... ${INVOKER_USERNAME} + ... ${invoker_username} ${resp}= Post Request Capif ... ${register_user_info['ccf_onboarding_url']} ... json=${request_body} @@ -437,12 +452,15 @@ Invoker Default Onboarding # Assertions Status Should Be 201 ${resp} Check Variable ${resp.json()} APIInvokerEnrolmentDetails - Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} + ${resource_url}= Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} # Store dummy signede certificate - Store In File ${INVOKER_USERNAME}.crt ${resp.json()['onboardingInformation']['apiInvokerCertificate']} + Store In File ${invoker_username}.crt ${resp.json()['onboardingInformation']['apiInvokerCertificate']} ${url}= Parse Url ${resp.headers['Location']} + Set To Dictionary ${register_user_info} resource_url=${resource_url} + Set To Dictionary ${register_user_info} management_cert=${invoker_username} + RETURN ${register_user_info} ${url} ${request_body} Provider Registration @@ -500,13 +518,15 @@ Provider Registration ... provider_enrollment_details=${request_body} ... resource_url=${resource_url} ... provider_register_response=${resp} + ... management_cert=${register_user_info['amf_username']} RETURN ${register_user_info} Provider Default Registration + [Arguments] ${provider_username}=${PROVIDER_USERNAME} # Register Provider ${register_user_info}= Register User At Jwt Auth Provider - ... username=${PROVIDER_USERNAME} role=${PROVIDER_ROLE} + ... username=${provider_username} role=${PROVIDER_ROLE} ${register_user_info}= Provider Registration ${register_user_info} @@ -591,3 +611,29 @@ Basic ACL registration END RETURN ${register_user_info_invoker} ${register_user_info_provider} ${service_api_description_published} + +Create Security Context Between invoker and provider + [Arguments] ${register_user_info_invoker} ${register_user_info_provider} + + ${discover_response}= Get Request Capif + ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${register_user_info_invoker['management_cert']} + + Check Response Variable Type And Values ${discover_response} 200 DiscoveredAPIs + + # create Security Context + ${request_body}= Create Service Security From Discover Response + ... http://${CAPIF_HOSTNAME}:${CAPIF_HTTP_PORT}/test + ... ${discover_response} + + ${resp}= Put Request Capif + ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} + ... json=${request_body} + ... server=${CAPIF_HTTPS_URL} + ... verify=ca.crt + ... username=${register_user_info_invoker['management_cert']} + + Check Response Variable Type And Values ${resp} 201 ServiceSecurity + diff --git a/tests/tasks/Dummy Info/__init__.robot b/tests/tasks/Dummy Info/__init__.robot new file mode 100644 index 0000000..f6bbb18 --- /dev/null +++ b/tests/tasks/Dummy Info/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Force Tags populate \ No newline at end of file diff --git a/tests/tasks/Dummy Info/populate.robot b/tests/tasks/Dummy Info/populate.robot new file mode 100644 index 0000000..9a61a40 --- /dev/null +++ b/tests/tasks/Dummy Info/populate.robot @@ -0,0 +1,126 @@ +*** Settings *** +Resource /opt/robot-tests/tests/resources/common.resource +Resource /opt/robot-tests/tests/resources/api_invoker_management_requests/apiInvokerManagementRequests.robot +Resource ../../resources/common.resource +Resource ../../resources/common/basicRequests.robot +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Process +Library Collections +Library ArchiveLibrary +Library OperatingSystem +Library DateTime + +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment + + +*** Variables *** +${API_INVOKER_NOT_REGISTERED} not-valid +${TOTAL_INVOKERS} 10 +${TOTAL_PROVIDERS} 10 + +${BACKUP_DIRECTORY} backup +${RESULT_FOLDER} /opt/robot-tests/results +${OUTPUT_ZIP_FILE} entities_loaded.zip + +${INVOKER_USERNAME_POPULATE} ${INVOKER_USERNAME}_POPULATE +${PROVIDER_USERNAME_POPULATE} ${PROVIDER_USERNAME}_POPULATE + + +*** Test Cases *** +Create Dummy Invokers and Providers + [Tags] populate-create + ${entities_dictionary}= Create Dictionary + Create Directory ${BACKUP_DIRECTORY} + + FOR ${counter} IN RANGE ${TOTAL_PROVIDERS} + ${USERNAME}= Set Variable ${PROVIDER_USERNAME_POPULATE}_${counter} + ${register_user_info}= Run Keyword And Continue On Failure Provider Default Registration ${USERNAME} + + Set To Dictionary ${entities_dictionary} ${USERNAME}=${register_user_info} + Copy Files *${USERNAME}* ${BACKUP_DIRECTORY}/ + + ${service_api_description_published} + ... ${resource_url} + ... ${request_body}= + ... Run Keyword And Continue On Failure + ... Publish Service Api + ... ${register_user_info} + ... ROBOT_SERVICE_${counter} + END + + ${last_provider_used}= Evaluate -1 + FOR ${counter} IN RANGE ${TOTAL_INVOKERS} + ${USERNAME}= Set Variable ${INVOKER_USERNAME_POPULATE}_${counter} + ${register_user_info} ${url} ${request_body}= Run Keyword And Continue On Failure + ... Invoker Default Onboarding + ... ${USERNAME} + + IF ${TOTAL_PROVIDERS} > 0 + ${last_provider_used} ${register_user_info_provider}= Get Provider + ... ${last_provider_used} + ... ${entities_dictionary} + Log Dictionary ${register_user_info_provider} + + Run Keyword And Continue On Failure + ... Create Security Context Between invoker and provider + ... ${register_user_info} + ... ${register_user_info_provider} + END + + Set To Dictionary ${entities_dictionary} ${USERNAME}=${register_user_info} + Copy Files ${USERNAME}* ${BACKUP_DIRECTORY}/ + END + + Write Dictionary ${BACKUP_DIRECTORY}/registers.json ${entities_dictionary} + ${date}= Get Current Date result_format=%Y_%m_%d_%H_%M_%S + Create Zip From Files In Directory ${BACKUP_DIRECTORY} ${RESULT_FOLDER}/${date}_${OUTPUT_ZIP_FILE} + + ${result}= Run Process ls -l + + Log Many ${result.stdout} + +Remove Dummy Invokers and Providers + [Tags] populate-remove + ${files}= List Files In Directory ${RESULT_FOLDER} *${OUTPUT_ZIP_FILE} + ${sorted_list}= Copy List ${files} + + Sort List ${sorted_list} + ${last_backup}= Get From List ${sorted_list} -1 + + Copy File ${RESULT_FOLDER}/${last_backup} ./ + Extract Zip File ${last_backup} + + ${entities_dictionary}= Read Dictionary registers.json + + Log Dictionary ${entities_dictionary} + + FOR ${username} IN @{entities_dictionary} + Log ${username}=${entities_dictionary}[${username}] + ${resource_url}= Set Variable ${entities_dictionary}[${username}][resource_url] + ${management_cert}= Set Variable ${entities_dictionary}[${username}][management_cert] + Run Keyword And Ignore Error Remove Resource ${resource_url.path} ${management_cert} ${username} + END + + ${result}= Run Process ls -l + + Log Many ${result.stdout} + + +*** Keywords *** +Get Provider + [Arguments] ${index} ${entities_dictionary} + ${index}= Evaluate ${index} + 1 + IF ${index} == ${TOTAL_PROVIDERS} + ${index}= Evaluate 0 + END + + ${username}= Set Variable ${PROVIDER_USERNAME_POPULATE}_${index} + ${usernames}= Get Dictionary Keys ${entities_dictionary} + IF '${username}' in ${usernames} + log ${username} is in the list + ELSE + Log Dictionary not contain ${username}, no provider returned + END + + RETURN ${index} ${entities_dictionary}[${username}] diff --git a/tests/tasks/__init__.robot b/tests/tasks/__init__.robot new file mode 100644 index 0000000..a65a0e7 --- /dev/null +++ b/tests/tasks/__init__.robot @@ -0,0 +1,56 @@ +*** Settings *** +Resource /opt/robot-tests/tests/resources/common.resource +Resource ../resources/common.resource + +Suite Setup Prepare environment +# Suite Teardown Reset Testing Environment + +Force Tags tasks + + +*** Keywords *** +Prepare environment + Log ${CAPIF_HOSTNAME} + Log "${CAPIF_HTTP_PORT}" + Log "${CAPIF_HTTPS_PORT}" + + Set Global Variable ${CAPIF_HTTP_VAULT_URL} http://${CAPIF_VAULT}/ + IF "${CAPIF_VAULT_PORT}" != "" + Set Global Variable ${CAPIF_HTTP_VAULT_URL} http://${CAPIF_VAULT}:${CAPIF_VAULT_PORT}/ + END + + Set Global Variable ${CAPIF_HTTPS_REGISTER_URL} https://${CAPIF_REGISTER}/ + IF "${CAPIF_REGISTER_PORT}" != "" + Set Global Variable ${CAPIF_HTTPS_REGISTER_URL} https://${CAPIF_REGISTER}:${CAPIF_REGISTER_PORT}/ + END + + Set Global Variable ${CAPIF_HTTP_URL} http://${CAPIF_HOSTNAME}/ + IF "${CAPIF_HTTP_PORT}" != "" + Set Global Variable ${CAPIF_HTTP_URL} http://${CAPIF_HOSTNAME}:${CAPIF_HTTP_PORT}/ + END + + Set Global Variable ${CAPIF_HTTPS_URL} https://${CAPIF_HOSTNAME}/ + IF "${CAPIF_HTTPS_PORT}" != "" + Set Global Variable ${CAPIF_HTTPS_URL} https://${CAPIF_HOSTNAME}:${CAPIF_HTTPS_PORT}/ + END + + ${status} ${CAPIF_IP}= Run Keyword And Ignore Error Get Ip From Hostname ${CAPIF_HOSTNAME} + + IF "${status}" == "PASS" + Log We will use a remote deployment + Log ${CAPIF_IP} + ELSE + Log We will use a local deployment + Add Dns To Hosts 127.0.0.1 ${CAPIF_HOSTNAME} + END + # Obtain ca root certificate + Retrieve Ca Root + + Reset Testing Environment + +Retrieve Ca Root + [Documentation] This keyword retrieve ca.root from CAPIF and store it at ca.crt in order to use at TLS communications + ${resp}= Get CA Vault /v1/secret/data/ca ${CAPIF_HTTP_VAULT_URL} + Status Should Be 200 ${resp} + Log ${resp.json()['data']['data']['ca']} + Store In File ca.crt ${resp.json()['data']['data']['ca']} -- GitLab From a5173bdd04d73a4eab2fc8944e4b7e12f2df8da3 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 17 Apr 2024 17:14:53 +0200 Subject: [PATCH 2/3] Upgrade Robot to new Register flow --- .../capif_api_access_control_policy.robot | 15 +- .../capif_auditing_api.robot | 20 +- .../capif_api_service_discover.robot | 24 +- .../CAPIF Api Events/capif_events_api.robot | 10 +- .../capif_api_invoker_managenet.robot | 8 - .../capif_logging_api.robot | 20 +- .../capif_api_provider_management.robot | 86 ++++--- .../capif_api_publish_service.robot | 32 +-- .../capif_security_api.robot | 88 +++---- tests/libraries/environment.py | 22 +- tests/resources/common.resource | 15 +- tests/resources/common/basicRequests.robot | 227 +++++++++++++----- 12 files changed, 338 insertions(+), 229 deletions(-) diff --git a/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot b/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot index 1772f3b..905e4c7 100644 --- a/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot +++ b/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot @@ -28,7 +28,7 @@ Retrieve ACL ... update_capif_users_dicts ... ${register_user_info_provider['resource_url'].path} ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} @@ -51,7 +51,7 @@ Retrieve ACL ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -102,7 +102,6 @@ Retrieve ACL with 2 Service APIs published ... update_capif_users_dicts ... ${register_user_info_provider['resource_url'].path} ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} @@ -119,7 +118,6 @@ Retrieve ACL with 2 Service APIs published ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} # Test ${discover_response}= Get Request Capif @@ -184,7 +182,6 @@ Retrieve ACL with security context created by two different Invokers ... update_capif_users_dicts ... ${register_user_info_provider['resource_url'].path} ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} @@ -207,7 +204,6 @@ Retrieve ACL with security context created by two different Invokers ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} ${INVOKER_USERNAME_2}= Set Variable ${INVOKER_USERNAME}_2 @@ -216,7 +212,6 @@ Retrieve ACL with security context created by two different Invokers ... ${INVOKER_USERNAME_2} Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME_2} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME_2} # Get Published APIs ${discover_response}= Get Request Capif @@ -301,7 +296,7 @@ Retrieve ACL filtered by api-invoker-id ... update_capif_users_dicts ... ${register_user_info_provider['resource_url'].path} ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} @@ -324,7 +319,7 @@ Retrieve ACL filtered by api-invoker-id ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${INVOKER_USERNAME_2}= Set Variable ${INVOKER_USERNAME}_2 @@ -333,7 +328,7 @@ Retrieve ACL filtered by api-invoker-id ... ${INVOKER_USERNAME_2} Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME_2} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME_2} + # Get Published APIs ${discover_response}= Get Request Capif diff --git a/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot b/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot index e4052ef..4c0a393 100644 --- a/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot +++ b/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot @@ -23,7 +23,7 @@ Get Log Entry ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -32,7 +32,7 @@ Get Log Entry ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -68,7 +68,7 @@ Get a log entry without entry created ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -77,7 +77,7 @@ Get a log entry without entry created ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp_1}= Get Request Capif @@ -100,7 +100,7 @@ Get a log entry withut aefid and apiInvokerId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -109,7 +109,7 @@ Get a log entry withut aefid and apiInvokerId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -149,7 +149,7 @@ Get Log Entry with apiVersion filter ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -158,7 +158,7 @@ Get Log Entry with apiVersion filter ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -194,7 +194,7 @@ Get Log Entry with no exist apiVersion filter ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -203,7 +203,7 @@ Get Log Entry with no exist apiVersion filter ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif diff --git a/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot b/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot index 0e2a5f7..2b7ed5b 100644 --- a/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot +++ b/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot @@ -20,7 +20,7 @@ Discover Published service APIs by Authorised API Invoker ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api @@ -30,7 +30,7 @@ Discover Published service APIs by Authorised API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${resp}= Get Request Capif @@ -54,7 +54,7 @@ Discover Published service APIs by Non Authorised API Invoker ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -63,7 +63,7 @@ Discover Published service APIs by Non Authorised API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -84,7 +84,7 @@ Discover Published service APIs by not registered API Invoker ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -93,7 +93,7 @@ Discover Published service APIs by not registered API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp}= Get Request Capif ... ${DISCOVER_URL}${API_INVOKER_NOT_REGISTERED} @@ -114,7 +114,7 @@ Discover Published service APIs by registered API Invoker with 1 result filtered ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name_1}= Set Variable service_1 ${api_name_2}= Set Variable service_2 @@ -131,7 +131,7 @@ Discover Published service APIs by registered API Invoker with 1 result filtered ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Request all APIs for Invoker ${resp}= Get Request Capif @@ -168,7 +168,7 @@ Discover Published service APIs by registered API Invoker filtered with no match ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name_1}= Set Variable apiName1 ${api_name_2}= Set Variable apiName2 @@ -185,7 +185,7 @@ Discover Published service APIs by registered API Invoker filtered with no match ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Request all APIs for Invoker ${resp}= Get Request Capif @@ -222,7 +222,7 @@ Discover Published service APIs by registered API Invoker not filtered ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name_1}= Set Variable apiName1 ${api_name_2}= Set Variable apiName2 @@ -239,7 +239,7 @@ Discover Published service APIs by registered API Invoker not filtered ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Request all APIs for Invoker ${resp}= Get Request Capif diff --git a/tests/features/CAPIF Api Events/capif_events_api.robot b/tests/features/CAPIF Api Events/capif_events_api.robot index aecff95..c027769 100644 --- a/tests/features/CAPIF Api Events/capif_events_api.robot +++ b/tests/features/CAPIF Api Events/capif_events_api.robot @@ -22,7 +22,7 @@ Creates a new individual CAPIF Event Subscription ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Events Subscription ${resp}= Post Request Capif @@ -42,7 +42,7 @@ Creates a new individual CAPIF Event Subscription with Invalid SubscriberId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Events Subscription ${resp}= Post Request Capif @@ -65,7 +65,7 @@ Deletes an individual CAPIF Event Subscription ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Events Subscription ${resp}= Post Request Capif @@ -93,7 +93,7 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriberId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Events Subscription ${resp}= Post Request Capif @@ -128,7 +128,7 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriptionId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Events Subscription ${resp}= Post Request Capif diff --git a/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot b/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot index 48eaa87..7127cc4 100644 --- a/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot +++ b/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot @@ -37,7 +37,6 @@ Onboard NetApp Check Response Variable Type And Values ${resp} 201 APIInvokerEnrolmentDetails ${url}= Parse Url ${resp.headers['Location']} Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} # Store dummy signed certificate @@ -49,7 +48,6 @@ Register NetApp Already Onboarded ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} ${resp}= Post Request Capif ... ${register_user_info['ccf_onboarding_url']} @@ -73,7 +71,6 @@ Update Onboarded NetApp ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} Set To Dictionary ... ${request_body} @@ -96,7 +93,6 @@ Update Not Onboarded NetApp ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} ${resp}= Put Request Capif ... /api-invoker-management/v1/onboardedInvokers/${INVOKER_NOT_REGISTERED} @@ -117,8 +113,6 @@ Offboard NetApp # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} - ${resp}= Delete Request Capif ... ${url.path} ... server=${CAPIF_HTTPS_URL} @@ -134,7 +128,6 @@ Offboard Not Previously Onboarded NetApp ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} ${resp}= Delete Request Capif ... /api-invoker-management/v1/onboardedInvokers/${INVOKER_NOT_REGISTERED} @@ -157,7 +150,6 @@ Update Onboarded NetApp Certificate ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} ${INVOKER_USERNAME_NEW}= Set Variable ${INVOKER_USERNAME}_NEW diff --git a/tests/features/CAPIF Api Logging Service/capif_logging_api.robot b/tests/features/CAPIF Api Logging Service/capif_logging_api.robot index de9c672..2604bdb 100644 --- a/tests/features/CAPIF Api Logging Service/capif_logging_api.robot +++ b/tests/features/CAPIF Api Logging Service/capif_logging_api.robot @@ -21,7 +21,7 @@ Create a log entry ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -30,7 +30,7 @@ Create a log entry ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -60,7 +60,7 @@ Create a log entry invalid aefId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -69,7 +69,7 @@ Create a log entry invalid aefId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -103,7 +103,7 @@ Create a log entry invalid serviceApi ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -112,7 +112,7 @@ Create a log entry invalid serviceApi ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -141,7 +141,7 @@ Create a log entry invalid apiInvokerId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -150,7 +150,7 @@ Create a log entry invalid apiInvokerId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} @@ -183,7 +183,7 @@ Create a log entry different aef_id in body ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish one api Publish Service Api ${register_user_info} @@ -192,7 +192,7 @@ Create a log entry different aef_id in body ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${discover_response}= Get Request Capif diff --git a/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot b/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot index fd70925..f47385f 100644 --- a/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot +++ b/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot @@ -1,12 +1,12 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Resource ../../resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library Process -Library Collections +Resource /opt/robot-tests/tests/resources/common.resource +Resource ../../resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Process +Library Collections -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment *** Variables *** @@ -16,7 +16,7 @@ ${API_PROVIDER_NOT_REGISTERED} notValid *** Test Cases *** Register Api Provider [Tags] capif_api_provider_management-1 - #Register Provider User An create Certificates for each function + # Register Provider User An create Certificates for each function ${register_user_info}= Register User At Jwt Auth Provider ... username=${PROVIDER_USERNAME} role=${PROVIDER_ROLE} @@ -51,12 +51,10 @@ Register Api Provider Check Response Variable Type And Values ${resp} 201 APIProviderEnrolmentDetails ${url}= Parse Url ${resp.headers['Location']} - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${register_user_info['amf_username']} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${register_user_info['amf_username']} ${resource_url}= Check Location Header ${resp} ${LOCATION_PROVIDER_RESOURCE_REGEX} - FOR ${prov} IN @{resp.json()['apiProvFuncs']} Log Dictionary ${prov} Store In File ${prov['apiProvFuncInfo']}.crt ${prov['regInfo']['apiProvCert']} @@ -66,9 +64,11 @@ Register Api Provider Already registered [Tags] capif_api_provider_management-2 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} - + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${AMF_PROVIDER_USERNAME} ${resp}= Post Request Capif ... /api-provider-management/v1/registrations @@ -88,8 +88,11 @@ Update Registered Api Provider [Tags] capif_api_provider_management-3 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${AMF_PROVIDER_USERNAME} ${request_body}= Set Variable ${register_user_info['provider_enrollment_details']} @@ -124,8 +127,11 @@ Update Not Registered Api Provider [Tags] capif_api_provider_management-4 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${AMF_PROVIDER_USERNAME} ${request_body}= Set Variable ${register_user_info['provider_enrollment_details']} @@ -144,31 +150,34 @@ Update Not Registered Api Provider ... cause=Not found registrations to send this api provider details # Partially Update Registered Api Provider -# [Tags] capif_api_provider_management-5 -# ${register_user_info}= Provider Default Registration +# [Tags] capif_api_provider_management-5 +# ${register_user_info}= Provider Default Registration -# ${request_body}= Create Api Provider Enrolment Details Patch Body ROBOT_TESTING_MOD +# ${request_body}= Create Api Provider Enrolment Details Patch Body ROBOT_TESTING_MOD -# ${resp}= Patch Request Capif -# ... ${register_user_info['resource_url'].path} -# ... json=${request_body} -# ... server=${CAPIF_HTTPS_URL} -# ... verify=ca.crt -# ... username=${AMF_PROVIDER_USERNAME} +# ${resp}= Patch Request Capif +# ... ${register_user_info['resource_url'].path} +# ... json=${request_body} +# ... server=${CAPIF_HTTPS_URL} +# ... verify=ca.crt +# ... username=${AMF_PROVIDER_USERNAME} -# Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${register_user_info['amf_username']} -# Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} +# Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${register_user_info['amf_username']} +# -# # Check Results -# Check Response Variable Type And Values ${resp} 200 APIProviderEnrolmentDetails -# ... apiProvDomInfo=ROBOT_TESTING_MOD +# # Check Results +# Check Response Variable Type And Values ${resp} 200 APIProviderEnrolmentDetails +# ... apiProvDomInfo=ROBOT_TESTING_MOD Partially Update Not Registered Api Provider [Tags] capif_api_provider_management-6 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${AMF_PROVIDER_USERNAME} ${request_body}= Create Api Provider Enrolment Details Patch Body @@ -190,8 +199,6 @@ Delete Registered Api Provider [Tags] capif_api_provider_management-7 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} - ${resp}= Delete Request Capif ... ${register_user_info['resource_url'].path} ... server=${CAPIF_HTTPS_URL} @@ -205,8 +212,11 @@ Delete Not Registered Api Provider [Tags] capif_api_provider_management-8 ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${AMF_PROVIDER_USERNAME} ${resp}= Delete Request Capif ... /api-provider-management/v1/registrations/${API_PROVIDER_NOT_REGISTERED} 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 cd58b3e..daef4be 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 @@ -20,7 +20,7 @@ Publish API by Authorised API Publisher ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Test ${request_body}= Create Service Api Description service_1 @@ -42,7 +42,7 @@ Publish API by NON Authorised API Publisher ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${request_body}= Create Service Api Description ${resp}= Post Request Capif @@ -64,7 +64,7 @@ Retrieve all APIs Published by Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Register One Service ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api @@ -92,7 +92,7 @@ Retrieve all APIs Published by NON Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Retrieve Services published ${resp}= Get Request Capif @@ -113,7 +113,7 @@ Retrieve single APIs Published by Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -152,7 +152,7 @@ Retrieve single APIs non Published by Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${resp}= Get Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} @@ -172,7 +172,7 @@ Retrieve single APIs Published by NON Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Publish Service API ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api @@ -183,7 +183,7 @@ Retrieve single APIs Published by NON Authorised apfId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp}= Get Request Capif ... ${resource_url.path} @@ -203,7 +203,7 @@ Update API Published by Authorised apfId with valid serviceApiId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -236,7 +236,7 @@ Update APIs Published by Authorised apfId with invalid serviceApiId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -261,7 +261,7 @@ Update APIs Published by NON Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -271,7 +271,7 @@ Update APIs Published by NON Authorised apfId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Api Description service_1_modified ${resp}= Put Request Capif @@ -303,7 +303,7 @@ Delete API Published by Authorised apfId with valid serviceApiId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -334,7 +334,7 @@ Delete APIs Published by Authorised apfId with invalid serviceApiId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${resp}= Delete Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} @@ -353,13 +353,13 @@ Delete APIs Published by NON Authorised apfId ${register_user_info}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + #Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp}= Delete Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} diff --git a/tests/features/CAPIF Security Api/capif_security_api.robot b/tests/features/CAPIF Security Api/capif_security_api.robot index c920d01..4e27948 100644 --- a/tests/features/CAPIF Security Api/capif_security_api.robot +++ b/tests/features/CAPIF Security Api/capif_security_api.robot @@ -23,7 +23,7 @@ Create a security context for an API invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} @@ -44,13 +44,13 @@ Create a security context for an API invoker with Provider role ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Register Provider ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} @@ -74,7 +74,7 @@ Create a security context for an API invoker with Provider entity role and inval ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} @@ -98,7 +98,7 @@ Create a security context for an API invoker with Invalid apiInvokerID ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -121,7 +121,7 @@ Retrieve the Security Context of an API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -140,7 +140,7 @@ Retrieve the Security Context of an API Invoker ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Retrieve Security context can setup by parameters if authenticationInfo and authorizationInfo are needed at response. # ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']}?authenticationInfo=true&authorizationInfo=true @@ -166,7 +166,7 @@ Retrieve the Security Context of an API Invoker with invalid apiInvokerID ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${resp}= Get Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} @@ -186,7 +186,7 @@ Retrieve the Security Context of an API Invoker with invalid apfId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -218,7 +218,7 @@ Delete the Security Context of an API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -234,7 +234,7 @@ Delete the Security Context of an API Invoker ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Remove Security Context ${resp}= Delete Request Capif @@ -264,7 +264,7 @@ Delete the Security Context of an API Invoker with Invoker entity role ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -295,7 +295,7 @@ Delete the Security Context of an API Invoker with Invoker entity role and inval ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${resp}= Delete Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} @@ -316,7 +316,7 @@ Delete the Security Context of an API Invoker with invalid apiInvokerID ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${resp}= Delete Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} @@ -337,13 +337,13 @@ Update the Security Context of an API Invoker ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Register Provider ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -390,7 +390,7 @@ Update the Security Context of an API Invoker with Provider entity role ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -406,7 +406,7 @@ Update the Security Context of an API Invoker with Provider entity role ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${resp}= Post Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']}/update @@ -428,7 +428,7 @@ Update the Security Context of an API Invoker with AEF entity role and invalid a ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Post Request Capif @@ -450,7 +450,7 @@ Update the Security Context of an API Invoker with invalid apiInvokerID ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Post Request Capif @@ -473,7 +473,7 @@ Revoke the authorization of the API invoker for APIs ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -486,7 +486,7 @@ Revoke the authorization of the API invoker for APIs ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test @@ -546,7 +546,7 @@ Revoke the authorization of the API invoker for APIs without valid apfID. ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -564,7 +564,7 @@ Revoke the authorization of the API invoker for APIs without valid apfID. ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + # Revoke Security Context by Invoker ${request_body}= Create Security Notification Body ${register_user_info_invoker['api_invoker_id']} 1234 @@ -602,7 +602,7 @@ Revoke the authorization of the API invoker for APIs with invalid apiInvokerId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -620,7 +620,7 @@ Revoke the authorization of the API invoker for APIs with invalid apiInvokerId ${register_user_info_publisher}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${request_body}= Create Security Notification Body ${API_INVOKER_NOT_VALID} 1234 ${resp}= Post Request Capif @@ -653,7 +653,7 @@ Retrieve access token ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -666,7 +666,7 @@ Retrieve access token ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -712,7 +712,7 @@ Retrieve access token by Provider ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -725,7 +725,7 @@ Retrieve access token by Provider ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -770,7 +770,7 @@ Retrieve access token by Provider with invalid apiInvokerId ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -783,7 +783,7 @@ Retrieve access token by Provider with invalid apiInvokerId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -829,7 +829,7 @@ Retrieve access token with invalid apiInvokerId ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -842,7 +842,7 @@ Retrieve access token with invalid apiInvokerId ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -890,7 +890,7 @@ Retrieve access token with invalid client_id ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -903,7 +903,7 @@ Retrieve access token with invalid client_id ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -949,7 +949,7 @@ Retrieve access token with unsupported grant_type ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -962,7 +962,7 @@ Retrieve access token with unsupported grant_type ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -1015,7 +1015,7 @@ Retrieve access token with invalid scope ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -1028,7 +1028,7 @@ Retrieve access token with invalid scope ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -1076,7 +1076,7 @@ Retrieve access token with invalid aefid at scope ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -1089,7 +1089,7 @@ Retrieve access token with invalid aefid at scope ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif @@ -1137,7 +1137,7 @@ Retrieve access token with invalid apiName at scope ${register_user_info_provider}= Provider Default Registration Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + ${api_name}= Set Variable service_1 @@ -1150,7 +1150,7 @@ Retrieve access token with invalid apiName at scope ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} + # Test ${discover_response}= Get Request Capif diff --git a/tests/libraries/environment.py b/tests/libraries/environment.py index d8100fa..8b7a504 100644 --- a/tests/libraries/environment.py +++ b/tests/libraries/environment.py @@ -1,10 +1,10 @@ class CapifUserManager(): def __init__(self): self.capif_users = {} - self.register_users = [] + self.register_users = {} - def update_register_users(self, value): - self.register_users.append(value) + def update_register_users(self, uuid, username): + self.register_users[uuid] = username def update_capif_users_dicts(self, key, value): self.capif_users[key] = value @@ -12,14 +12,22 @@ class CapifUserManager(): def remove_capif_users_entry(self, key): self.capif_users.pop(key) - def remove_register_users_entry(self, value): - self.register_users.remove(value) + def remove_register_users_entry(self, uuid=None, username=None): + if uuid != None: + self.register_users.pop(uuid) + elif username != None: + uuid=self.get_user_uuid(username) + self.register_users.pop(uuid) def get_capif_users_dict(self): return self.capif_users - def get_register_users(self): + def get_register_users_dict(self): return self.register_users - + + def get_user_uuid(self, username): + for uuid, stored_user in self.register_users.items(): + if stored_user == username: + return uuid CAPIF_USERS = CapifUserManager() \ No newline at end of file diff --git a/tests/resources/common.resource b/tests/resources/common.resource index b111127..c46131b 100644 --- a/tests/resources/common.resource +++ b/tests/resources/common.resource @@ -1,7 +1,7 @@ *** Settings *** -Library /opt/robot-tests/tests/libraries/helpers.py -Variables /opt/robot-tests/tests/libraries/environment.py -Resource /opt/robot-tests/tests/resources/common/basicRequests.robot +Library /opt/robot-tests/tests/libraries/helpers.py +Variables /opt/robot-tests/tests/libraries/environment.py +Resource /opt/robot-tests/tests/resources/common/basicRequests.robot *** Variables *** @@ -21,12 +21,15 @@ ${CAPIF_VAULT_PORT} 8200 ${CAPIF_VAULT_TOKEN} read-ca-token ${CAPIF_REGISTER} register ${CAPIF_REGISTER_PORT} 8084 -${CAPIF_HTTP_PORT} -${CAPIF_HTTPS_PORT} +${CAPIF_HTTP_PORT} ${EMPTY} +${CAPIF_HTTPS_PORT} ${EMPTY} ${CAPIF_IP} 127.0.0.1 ${CAPIF_CALLBACK_IP} host.docker.internal ${CAPIF_CALLBACK_PORT} 8086 +${REGISTER_ADMIN_USER} admin +${REGISTER_ADMIN_PASSWORD} password123 + ${DISCOVER_URL} /service-apis/v1/allServiceAPIs?api-invoker-id= @@ -34,7 +37,7 @@ ${DISCOVER_URL} /service-apis/v1/allServiceAPIs?api-invoker-id= Reset Testing Environment Log Db capif.invokerdetails collection will be removed in order to isolate each test. - #Clean Test Information By HTTP Requests + # Clean Test Information By HTTP Requests Clean Test Information Check Location Header diff --git a/tests/resources/common/basicRequests.robot b/tests/resources/common/basicRequests.robot index 580c7d0..3a24b84 100644 --- a/tests/resources/common/basicRequests.robot +++ b/tests/resources/common/basicRequests.robot @@ -5,6 +5,7 @@ Library RequestsLibrary Library Collections Library OperatingSystem Library XML +Library Telnet *** Variables *** @@ -53,6 +54,97 @@ Create CAPIF Session RETURN ${headers} +Create Register Admin Session + [Documentation] Create needed session to reach Register as Administrator. + [Arguments] ${server}=${NONE} ${access_token}=${NONE} ${verify}=${NONE} ${vault_token}=${NONE} + IF "${server}" != "${NONE}" + IF "${access_token}" != "${NONE}" + ## Return Header with bearer + ${headers}= Create Dictionary Authorization=Bearer ${access_token} + + RETURN ${headers} + END + + # Request Admin Login to retrieve access token + Create Session register_session ${server} verify=${verify} disable_warnings=1 + + ${auth}= Set variable ${{ ('${REGISTER_ADMIN_USER}','${REGISTER_ADMIN_PASSWORD}') }} + ${resp}= POST On Session register_session /login auth=${auth} + + Log Dictionary ${resp.json()} + + ## Crear sesiĆ³n con token + ${headers}= Create Dictionary Authorization=Bearer ${resp.json()['access_token']} + + RETURN ${headers} + END + + + RETURN ${NONE} + +## NEW REQUESTS TO REGISTER +Post Request Admin Register + [Timeout] 60s + [Arguments] + ... ${endpoint} + ... ${json}=${NONE} + ... ${server}=${NONE} + ... ${access_token}=${NONE} + ... ${auth}=${NONE} + ... ${verify}=${FALSE} + ... ${cert}=${NONE} + ... ${username}=${NONE} + ... ${data}=${NONE} + + ${headers}= Create Register Admin Session ${server} ${access_token} ${verify} + + IF '${username}' != '${NONE}' + ${cert}= Set variable ${{ ('${username}.crt','${username}.key') }} + END + + ${resp}= POST On Session + ... register_session + ... ${endpoint} + ... headers=${headers} + ... json=${json} + ... expected_status=any + ... verify=${verify} + ... cert=${cert} + ... data=${data} + RETURN ${resp} + +Get Request Admin Register + [Timeout] 60s + [Arguments] + ... ${endpoint} + ... ${server}=${NONE} + ... ${access_token}=${NONE} + ... ${auth}=${NONE} + ... ${verify}=${FALSE} + ... ${cert}=${NONE} + ... ${username}=${NONE} + + ${headers}= Create Register Admin Session ${server} ${access_token} + + IF '${username}' != '${NONE}' + ${cert}= Set variable ${{ ('${username}.crt','${username}.key') }} + END + + ${resp}= GET On Session + ... register_session + ... ${endpoint} + ... headers=${headers} + ... expected_status=any + ... verify=${verify} + ... cert=${cert} + RETURN ${resp} + + + + +# NEW REQUESTS END + + Post Request Capif [Timeout] 60s [Arguments] @@ -235,24 +327,15 @@ Register User At Jwt Auth END Log cn=${cn} - - &{body}= Create Dictionary - ... password=${password} - ... username=${username} - ... role=${role} - ... description=${description} - ... cn=${cn} - - Create Session jwtsession ${CAPIF_HTTPS_REGISTER_URL} verify=False disable_warnings=1 - - ${resp}= POST On Session jwtsession /register json=${body} - - Should Be Equal As Strings ${resp.status_code} 201 + + ${resp}= Create User At Register ${username} ${password} ${description} email="${username}@nobody.com" ${get_auth_response}= Get Auth For User ${username} ${password} + Log Dictionary ${get_auth_response} + ${register_user_info}= Create Dictionary - ... netappID=${resp.json()['id']} + ... netappID=${resp.json()['uuid']} ... csr_request=${csr_request} ... &{resp.json()} ... &{get_auth_response} @@ -270,6 +353,8 @@ Register User At Jwt Auth Store In File ${username}.key ${register_user_info['private_key']} END + Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} + RETURN ${register_user_info} Register User At Jwt Auth Provider @@ -287,24 +372,14 @@ Register User At Jwt Auth Provider ${amf_csr_request}= Create User Csr ${amf_username} amf # Register provider - &{body}= Create Dictionary - ... password=${password} - ... username=${username} - ... role=${role} - ... description=${description} - ... cn=${username} - - Create Session jwtsession ${CAPIF_HTTPS_REGISTER_URL} verify=False disable_warnings=1 - - ${resp}= POST On Session jwtsession /register json=${body} - - Should Be Equal As Strings ${resp.status_code} 201 + ${resp}= Create User At Register ${username} ${password} ${description} email="${username}@nobody.com" - # Get Auth to obtain access_token ${get_auth_response}= Get Auth For User ${username} ${password} + Log Dictionary ${get_auth_response} + ${register_user_info}= Create Dictionary - ... netappID=${resp.json()['id']} + ... netappID=${resp.json()['uuid']} ... csr_request=${csr_request} ... apf_csr_request=${apf_csr_request} ... aef_csr_request=${aef_csr_request} @@ -317,25 +392,71 @@ Register User At Jwt Auth Provider Log Dictionary ${register_user_info} + Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} + RETURN ${register_user_info} -Get Auth For User - [Arguments] ${username} ${password} - &{body}= Create Dictionary username=${username} password=${password} +Login Register Admin + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} + RETURN ${headers} + +Create User At Register + [Documentation] (Administrator) This Keyword create a user at register component. + [Arguments] ${username} ${password} ${description} ${email} + + # Obtain Admin Token to request creation of User + ${headers}= Login Register Admin + + &{body}= Create Dictionary username=${username} password=${password} description=${description} email=${email} + ${resp}= Post On Session register_session /createUser headers=${headers} json=${body} + Should Be Equal As Strings ${resp.status_code} 201 + + RETURN ${resp} - ${resp}= POST On Session jwtsession /getauth json=${body} +Delete User At Register + [Documentation] (Administrator) This Keyword delete a user from register. + [Arguments] ${username}=${NONE} ${uuid}=${NONE} + ${user_uuid}= Set Variable ${uuid} + + IF "${username}" != "${NONE}" + ${user_uuid}= Call Method ${CAPIF_USERS} get_user_uuid ${username} + END + + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False + + ${resp}= DELETE On Session register_session /deleteUser/${user_uuid} headers=${headers} + + Should Be Equal As Strings ${resp.status_code} 204 + + Call Method ${CAPIF_USERS} remove_register_users_entry ${user_uuid} + + RETURN ${resp} + +Get List of User At Register + [Documentation] (Administrator) This Keyword retrieve a list of users from register. + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False + + ${resp}= DELETE On Session register_session /getUsers headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 - # Should Be Equal As Strings ${resp.json()['message']} Certificate created successfuly + RETURN ${resp.json()['users']} + +Get Auth For User + [Documentation] (User) This Keyword retrieve token to be used by user towards first interaction with CCF. + [Arguments] ${username} ${password} + ${auth}= Set variable ${{ ('${username}','${password}') }} + ${resp}= GET On Session register_session /getauth auth=${auth} + + Should Be Equal As Strings ${resp.status_code} 200 RETURN ${resp.json()} Clean Test Information ${capif_users_dict}= Call Method ${CAPIF_USERS} get_capif_users_dict - ${register_users}= Call Method ${CAPIF_USERS} get_register_users + ${register_users_dict}= Call Method ${CAPIF_USERS} get_register_users_dict ${keys}= Get Dictionary Keys ${capif_users_dict} @@ -352,18 +473,9 @@ Clean Test Information Call Method ${CAPIF_USERS} remove_capif_users_entry ${key} END - FOR ${user} IN @{register_users} - &{body}= Create Dictionary - ... password=password - ... username=${user} - - Create Session jwtsession ${CAPIF_HTTPS_REGISTER_URL} verify=False disable_warnings=1 - - ${resp}= DELETE On Session jwtsession /remove json=${body} - - Should Be Equal As Strings ${resp.status_code} 204 - - Call Method ${CAPIF_USERS} remove_register_users_entry ${user} + ${uuids}= Get Dictionary Keys ${register_users_dict} + FOR ${uuid} IN @{uuids} + Delete User At Register uuid=${uuid} END Remove entity @@ -371,10 +483,10 @@ Remove entity ${capif_users_dict}= Call Method ${CAPIF_USERS} get_capif_users_dict - ${register_users}= Call Method ${CAPIF_USERS} get_register_users + ${register_users_dict}= Call Method ${CAPIF_USERS} get_register_users_dict Log Dictionary ${capif_users_dict} - Log List ${register_users} + Log Dictionary ${register_users_dict} ${keys}= Get Dictionary Keys ${capif_users_dict} FOR ${key} IN @{keys} @@ -391,21 +503,11 @@ Remove entity Call Method ${CAPIF_USERS} remove_capif_users_entry ${key} END END - - &{body}= Create Dictionary - ... password=password - ... username=${entity_user} - - Create Session jwtsession ${CAPIF_HTTPS_REGISTER_URL} verify=False disable_warnings=1 - - ${resp}= DELETE On Session jwtsession /remove json=${body} - - Should Be Equal As Strings ${resp.status_code} 204 - - Call Method ${CAPIF_USERS} remove_register_users_entry ${entity_user} + + Delete User At Register username=${entity_user} Log Dictionary ${capif_users_dict} - Log List ${register_users} + Log Dictionary ${register_users_dict} Remove Resource [Arguments] ${resource_url} ${management_cert} ${username} @@ -560,7 +662,7 @@ Basic ACL registration ... update_capif_users_dicts ... ${register_user_info_provider['resource_url'].path} ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${PROVIDER_USERNAME} + Call Method ${CAPIF_USERS} update_register_users ${register_user_info_provider['uuid']} ${PROVIDER_USERNAME} ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} @@ -583,7 +685,6 @@ Basic ACL registration ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${INVOKER_USERNAME} # Test ${discover_response}= Get Request Capif -- GitLab From 123dcb2e23ba3af82f7b1bc8b0de313bd23d8cc1 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 17 Apr 2024 17:57:35 +0200 Subject: [PATCH 3/3] Code Refactor of delete entities --- .../capif_api_access_control_policy.robot | 44 +---- .../capif_auditing_api.robot | 133 ++++++--------- .../capif_api_service_discover.robot | 84 +++------- .../CAPIF Api Events/capif_events_api.robot | 37 ++--- .../capif_api_invoker_managenet.robot | 38 ++--- .../capif_logging_api.robot | 110 ++++++------- .../capif_api_provider_management.robot | 32 +--- .../capif_api_publish_service.robot | 89 +++------- .../capif_security_api.robot | 155 ++---------------- tests/resources/common/basicRequests.robot | 122 +++++++------- 10 files changed, 248 insertions(+), 596 deletions(-) diff --git a/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot b/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot index 905e4c7..04d7898 100644 --- a/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot +++ b/tests/features/CAPIF Api Access Control Policy/capif_api_access_control_policy.robot @@ -23,13 +23,6 @@ Retrieve ACL # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info_provider['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} ... service_1 @@ -50,9 +43,6 @@ Retrieve ACL # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -97,12 +87,6 @@ Retrieve ACL with 2 Service APIs published # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info_provider['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} ... service_1 @@ -117,8 +101,6 @@ Retrieve ACL with 2 Service APIs published # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -177,12 +159,6 @@ Retrieve ACL with security context created by two different Invokers # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info_provider['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} ... service_1 @@ -203,16 +179,12 @@ Retrieve ACL with security context created by two different Invokers # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - ${INVOKER_USERNAME_2}= Set Variable ${INVOKER_USERNAME}_2 # Register another invoker ${register_user_info_invoker_2} ${url} ${request_body}= Invoker Default Onboarding ... ${INVOKER_USERNAME_2} - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME_2} - # Get Published APIs ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -291,13 +263,6 @@ Retrieve ACL filtered by api-invoker-id # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info_provider['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} ... service_1 @@ -318,18 +283,12 @@ Retrieve ACL filtered by api-invoker-id # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${INVOKER_USERNAME_2}= Set Variable ${INVOKER_USERNAME}_2 # Register another invoker ${register_user_info_invoker_2} ${url} ${request_body}= Invoker Default Onboarding ... ${INVOKER_USERNAME_2} - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME_2} - - # Get Published APIs ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -602,7 +561,7 @@ No ACL for invoker after be removed Check Response Variable Type And Values ${resp} 200 AccessControlPolicyList - Remove entity ${INVOKER_USERNAME} + Remove entity ${INVOKER_USERNAME} ${resp}= Get Request Capif ... /access-control-policy/v1/accessControlPolicyList/${service_api_description_published['apiId']}?aef-id=${register_user_info_provider['aef_id']} @@ -619,4 +578,3 @@ No ACL for invoker after be removed ... title=Not Found ... detail=No ACLs found for the requested service: ${service_api_description_published['apiId']}, aef_id: ${register_user_info_provider['aef_id']}, invoker: None and supportedFeatures: None ... cause=Wrong id - diff --git a/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot b/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot index 4c0a393..0676168 100644 --- a/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot +++ b/tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot @@ -1,12 +1,13 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library Collections -Resource /opt/robot-tests/tests/resources/common/basicRequests.robot -Resource ../../resources/common.resource +Resource /opt/robot-tests/tests/resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Collections +Resource /opt/robot-tests/tests/resources/common/basicRequests.robot +Resource ../../resources/common.resource + +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment *** Variables *** ${AEF_ID_NOT_VALID} aef-example @@ -16,34 +17,33 @@ ${NOTIFICATION_DESTINATION} http://robot.testing:1080 ${API_VERSION_VALID} v1 ${API_VERSION_NOT_VALID} v58 + *** Test Cases *** Get Log Entry [Tags] capif_api_auditing_service-1 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp_1}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -51,7 +51,6 @@ Get Log Entry ... verify=ca.crt ... username=${AEF_PROVIDER_USERNAME} - ${resp_2}= Get Request Capif ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} @@ -60,67 +59,56 @@ Get Log Entry # Check Results Check Response Variable Type And Values ${resp_2} 200 InvocationLog - Length Should Be ${resp_2.json()["logs"]} 2 + Length Should Be ${resp_2.json()["logs"]} 2 Get a log entry without entry created [Tags] capif_api_auditing_service-2 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - - - ${resp_1}= Get Request Capif + ${resp_1}= Get Request Capif ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${AMF_PROVIDER_USERNAME} # Check Results - Check Response Variable Type And Values ${resp_1} 404 ProblemDetails + Check Response Variable Type And Values ${resp_1} 404 ProblemDetails ... title=Not Found ... status=404 ... detail=aefId or/and apiInvokerId do not match any InvocationLogs ... cause=No log invocations found - Get a log entry withut aefid and apiInvokerId [Tags] capif_api_auditing_service-3 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp_1}= Post Request Capif ... /api-invocation-logs/v1/${AEF_ID_NOT_VALID}/logs ... json=${request_body} @@ -128,48 +116,44 @@ Get a log entry withut aefid and apiInvokerId ... verify=ca.crt ... username=${AEF_PROVIDER_USERNAME} - - ${resp_2}= Get Request Capif + ${resp_2}= Get Request Capif ... /logs/v1/apiInvocationLogs ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${AMF_PROVIDER_USERNAME} # Check Results - Check Response Variable Type And Values ${resp_2} 400 ProblemDetails + Check Response Variable Type And Values ${resp_2} 400 ProblemDetails ... title=Bad Request ... status=400 ... detail=aef_id and api_invoker_id parameters are mandatory ... cause=Mandatory parameters missing - Get Log Entry with apiVersion filter [Tags] capif_api_auditing_service-4 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp_1}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -177,45 +161,41 @@ Get Log Entry with apiVersion filter ... verify=ca.crt ... username=${AEF_PROVIDER_USERNAME} - ${resp_2}= Get Request Capif - ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']}&api-version=${API_VERSION_VALID} + ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']}&api-version=${API_VERSION_VALID} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${AMF_PROVIDER_USERNAME} # Check Results Check Response Variable Type And Values ${resp_2} 200 InvocationLog - Length Should Be ${resp_2.json()["logs"]} 1 + Length Should Be ${resp_2.json()["logs"]} 1 -Get Log Entry with no exist apiVersion filter +Get Log Entry with no exist apiVersion filter [Tags] capif_api_auditing_service-5 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp_1}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -223,21 +203,16 @@ Get Log Entry with no exist apiVersion filter ... verify=ca.crt ... username=${AEF_PROVIDER_USERNAME} - ${resp_2}= Get Request Capif - ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']}&api-version=${API_VERSION_NOT_VALID} + ... /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker['api_invoker_id']}&api-version=${API_VERSION_NOT_VALID} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${AMF_PROVIDER_USERNAME} # Check Results - # Check Results - Check Response Variable Type And Values ${resp_2} 404 ProblemDetails + # Check Results + Check Response Variable Type And Values ${resp_2} 404 ProblemDetails ... title=Not Found ... status=404 ... detail=Parameters do not match any log entry ... cause=No logs found - - - - diff --git a/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot b/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot index 2b7ed5b..ff82ec3 100644 --- a/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot +++ b/tests/features/CAPIF Api Discover Service/capif_api_service_discover.robot @@ -1,11 +1,11 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Resource /opt/robot-tests/tests/resources/api_invoker_management_requests/apiInvokerManagementRequests.robot -Resource ../../resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py +Resource /opt/robot-tests/tests/resources/common.resource +Resource /opt/robot-tests/tests/resources/api_invoker_management_requests/apiInvokerManagementRequests.robot +Resource ../../resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment # Test Setup Initialize Test And Register role=invoker @@ -16,12 +16,9 @@ ${API_INVOKER_NOT_REGISTERED} not-valid *** Test Cases *** Discover Published service APIs by Authorised API Invoker [Tags] capif_api_discover_service-1 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -29,9 +26,6 @@ Discover Published service APIs by Authorised API Invoker # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} @@ -45,26 +39,19 @@ Discover Published service APIs by Authorised API Invoker Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions Should Not Be Empty ${resp.json()['serviceAPIDescriptions']} Length Should Be ${resp.json()['serviceAPIDescriptions']} 1 - List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published} - + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published} Discover Published service APIs by Non Authorised API Invoker [Tags] capif_api_discover_service-2 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} @@ -80,21 +67,15 @@ Discover Published service APIs by Non Authorised API Invoker Discover Published service APIs by not registered API Invoker [Tags] capif_api_discover_service-3 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${resp}= Get Request Capif ... ${DISCOVER_URL}${API_INVOKER_NOT_REGISTERED} ... server=${CAPIF_HTTPS_URL} @@ -110,12 +91,9 @@ Discover Published service APIs by not registered API Invoker Discover Published service APIs by registered API Invoker with 1 result filtered [Tags] capif_api_discover_service-4 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name_1}= Set Variable service_1 ${api_name_2}= Set Variable service_2 @@ -130,9 +108,6 @@ Discover Published service APIs by registered API Invoker with 1 result filtered # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Request all APIs for Invoker ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} @@ -145,8 +120,8 @@ Discover Published service APIs by registered API Invoker with 1 result filtered # 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} - List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} # Request api 1 ${resp}= Get Request Capif @@ -164,12 +139,9 @@ Discover Published service APIs by registered API Invoker with 1 result filtered Discover Published service APIs by registered API Invoker filtered with no match [Tags] capif_api_discover_service-5 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name_1}= Set Variable apiName1 ${api_name_2}= Set Variable apiName2 @@ -184,9 +156,6 @@ Discover Published service APIs by registered API Invoker filtered with no match # Change to invoker role and register at api invoker management ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Request all APIs for Invoker ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} @@ -199,8 +168,8 @@ Discover Published service APIs by registered API Invoker filtered with no match # 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} - List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} # Request api 1 ${resp}= Get Request Capif @@ -210,7 +179,10 @@ Discover Published service APIs by registered API Invoker filtered with no match ... username=${INVOKER_USERNAME} # Check Results - Check Response Variable Type And Values ${resp} 404 ProblemDetails + Check Response Variable Type And Values + ... ${resp} + ... 404 + ... ProblemDetails ... title=Not Found ... status=404 ... detail=API Invoker ${register_user_info_invoker['api_invoker_id']} has no API Published that accomplish filter conditions @@ -218,12 +190,9 @@ Discover Published service APIs by registered API Invoker filtered with no match Discover Published service APIs by registered API Invoker not filtered [Tags] capif_api_discover_service-6 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name_1}= Set Variable apiName1 ${api_name_2}= Set Variable apiName2 @@ -238,9 +207,6 @@ Discover Published service APIs by registered API Invoker not filtered # Change to invoker role and register at api invoker management ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Request all APIs for Invoker ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} @@ -253,5 +219,5 @@ Discover Published service APIs by registered API Invoker not filtered # Check Results 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} - List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_1} + List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published_2} diff --git a/tests/features/CAPIF Api Events/capif_events_api.robot b/tests/features/CAPIF Api Events/capif_events_api.robot index c027769..f2a5966 100644 --- a/tests/features/CAPIF Api Events/capif_events_api.robot +++ b/tests/features/CAPIF Api Events/capif_events_api.robot @@ -1,12 +1,12 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library XML -Resource /opt/robot-tests/tests/resources/common/basicRequests.robot -Resource ../../resources/common.resource +Resource /opt/robot-tests/tests/resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library XML +Resource /opt/robot-tests/tests/resources/common/basicRequests.robot +Resource ../../resources/common.resource -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment *** Variables *** @@ -21,9 +21,6 @@ Creates a new individual CAPIF Event Subscription # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Events Subscription ${resp}= Post Request Capif ... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions @@ -41,9 +38,6 @@ Creates a new individual CAPIF Event Subscription with Invalid SubscriberId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Events Subscription ${resp}= Post Request Capif ... /capif-events/v1/${SUBSCRIBER_ID_NOT_VALID}/subscriptions @@ -53,7 +47,7 @@ Creates a new individual CAPIF Event Subscription with Invalid SubscriberId ... username=${INVOKER_USERNAME} # Check Results - Check Response Variable Type And Values ${resp} 404 ProblemDetails + Check Response Variable Type And Values ${resp} 404 ProblemDetails ... title=Not Found ... status=404 ... detail=Invoker or APF or AEF or AMF Not found @@ -64,9 +58,6 @@ Deletes an individual CAPIF Event Subscription # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Events Subscription ${resp}= Post Request Capif ... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions @@ -92,9 +83,6 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriberId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Events Subscription ${resp}= Post Request Capif ... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions @@ -112,24 +100,20 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriberId ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - + # Check Results - Check Response Variable Type And Values ${resp} 404 ProblemDetails + Check Response Variable Type And Values ${resp} 404 ProblemDetails ... title=Not Found ... status=404 ... detail=Invoker or APF or AEF or AMF Not found ... cause=Subscriber Not Found - Deletes an individual CAPIF Event Subscription with invalid SubscriptionId [Tags] capif_api_events-5 # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Events Subscription ${resp}= Post Request Capif ... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions @@ -153,4 +137,3 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriptionId ... title=Unauthorized ... detail=User not authorized ... cause=You are not the owner of this resource - diff --git a/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot b/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot index 7127cc4..8c40f72 100644 --- a/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot +++ b/tests/features/CAPIF Api Invoker Management/capif_api_invoker_managenet.robot @@ -1,13 +1,13 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Resource /opt/robot-tests/tests/resources/api_invoker_management_requests/apiInvokerManagementRequests.robot -Resource ../../resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library Process -Library Collections +Resource /opt/robot-tests/tests/resources/common.resource +Resource /opt/robot-tests/tests/resources/api_invoker_management_requests/apiInvokerManagementRequests.robot +Resource ../../resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Process +Library Collections -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment *** Variables *** @@ -17,7 +17,7 @@ ${API_INVOKER_NOT_REGISTERED} not-valid *** Test Cases *** Onboard NetApp [Tags] capif_api_invoker_management-1 - #Register Netapp + # Register Netapp ${register_user_info}= Register User At Jwt Auth ... username=${INVOKER_USERNAME} role=${INVOKER_ROLE} @@ -34,9 +34,9 @@ Onboard NetApp ... access_token=${register_user_info['access_token']} # Check Results - Check Response Variable Type And Values ${resp} 201 APIInvokerEnrolmentDetails + Check Response Variable Type And Values ${resp} 201 APIInvokerEnrolmentDetails ${url}= Parse Url ${resp.headers['Location']} - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} + Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} # Store dummy signed certificate @@ -47,8 +47,6 @@ Register NetApp Already Onboarded # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - ${resp}= Post Request Capif ... ${register_user_info['ccf_onboarding_url']} ... json=${request_body} @@ -70,8 +68,6 @@ Update Onboarded NetApp # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - Set To Dictionary ... ${request_body} ... notificationDestination=${new_notification_destination} @@ -92,8 +88,6 @@ Update Not Onboarded NetApp # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - ${resp}= Put Request Capif ... /api-invoker-management/v1/onboardedInvokers/${INVOKER_NOT_REGISTERED} ... ${request_body} @@ -118,6 +112,8 @@ Offboard NetApp ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} + + Call Method ${CAPIF_USERS} remove_capif_users_entry ${url.path} # Check Results Should Be Equal As Strings ${resp.status_code} 204 @@ -127,8 +123,6 @@ Offboard Not Previously Onboarded NetApp # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - ${resp}= Delete Request Capif ... /api-invoker-management/v1/onboardedInvokers/${INVOKER_NOT_REGISTERED} ... server=${CAPIF_HTTPS_URL} @@ -149,9 +143,7 @@ Update Onboarded NetApp Certificate # Default Invoker Registration and Onboarding ${register_user_info} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${INVOKER_USERNAME_NEW}= Set Variable ${INVOKER_USERNAME}_NEW + ${INVOKER_USERNAME_NEW}= Set Variable ${INVOKER_USERNAME}_NEW ${csr_request_new}= Create User Csr ${INVOKER_USERNAME_NEW} invoker @@ -189,5 +181,3 @@ Update Onboarded NetApp Certificate # Check Results Check Response Variable Type And Values ${resp} 200 APIInvokerEnrolmentDetails ... notificationDestination=${new_notification_destination} - - diff --git a/tests/features/CAPIF Api Logging Service/capif_logging_api.robot b/tests/features/CAPIF Api Logging Service/capif_logging_api.robot index 2604bdb..a7a0253 100644 --- a/tests/features/CAPIF Api Logging Service/capif_logging_api.robot +++ b/tests/features/CAPIF Api Logging Service/capif_logging_api.robot @@ -1,12 +1,13 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library Collections -Resource /opt/robot-tests/tests/resources/common/basicRequests.robot -Resource ../../resources/common.resource +Resource /opt/robot-tests/tests/resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Collections +Resource /opt/robot-tests/tests/resources/common/basicRequests.robot +Resource ../../resources/common.resource + +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment *** Variables *** ${AEF_ID_NOT_VALID} aef-example @@ -14,34 +15,33 @@ ${SERVICE_API_ID_NOT_VALID} not-valid ${API_INVOKER_NOT_VALID} not-valid ${NOTIFICATION_DESTINATION} http://robot.testing:1080 + *** Test Cases *** Create a log entry [Tags] capif_api_logging_service-1 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -49,38 +49,35 @@ Create a log entry ... verify=ca.crt ... username=${AEF_PROVIDER_USERNAME} - # Check Results Check Response Variable Type And Values ${resp} 201 InvocationLog ${resource_url}= Check Location Header ${resp} ${LOCATION_LOGGING_RESOURCE_REGEX} Create a log entry invalid aefId [Tags] capif_api_logging_service-2 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp}= Post Request Capif ... /api-invocation-logs/v1/${AEF_ID_NOT_VALID}/logs ... json=${request_body} @@ -89,31 +86,23 @@ Create a log entry invalid aefId ... username=${AEF_PROVIDER_USERNAME} # Check Results - Check Response Variable Type And Values ${resp} 404 ProblemDetails + Check Response Variable Type And Values ${resp} 404 ProblemDetails ... title=Not Found ... status=404 ... detail=Exposer not exist ... cause=Exposer id not found - - Create a log entry invalid serviceApi [Tags] capif_api_logging_service-3 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} @@ -121,7 +110,9 @@ Create a log entry invalid serviceApi ... username=${INVOKER_USERNAME} # Create Log Entry - ${request_body}= Create Log Entry Bad Service ${register_user_info['aef_id']} ${register_user_info_invoker['api_invoker_id']} + ${request_body}= Create Log Entry Bad Service + ... ${register_user_info['aef_id']} + ... ${register_user_info_invoker['api_invoker_id']} ${resp}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -137,31 +128,29 @@ Create a log entry invalid serviceApi Create a log entry invalid apiInvokerId [Tags] capif_api_logging_service-4 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${register_user_info['aef_id']} ${API_INVOKER_NOT_VALID} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${register_user_info['aef_id']} + ... ${API_INVOKER_NOT_VALID} + ... ${api_ids} + ... ${api_names} ${resp}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -176,35 +165,31 @@ Create a log entry invalid apiInvokerId ... detail=Invoker not exist ... cause=Invoker id not found - Create a log entry different aef_id in body [Tags] capif_api_logging_service-5 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish one api Publish Service Api ${register_user_info} - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - - ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} - ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} + ${api_ids} ${api_names}= Get Api Ids And Names From Discover Response ${discover_response} # Create Log Entry - ${request_body}= Create Log Entry ${AEF_ID_NOT_VALID} ${register_user_info_invoker['api_invoker_id']} ${api_ids} ${api_names} + ${request_body}= Create Log Entry + ... ${AEF_ID_NOT_VALID} + ... ${register_user_info_invoker['api_invoker_id']} + ... ${api_ids} + ... ${api_names} ${resp}= Post Request Capif ... /api-invocation-logs/v1/${register_user_info['aef_id']}/logs ... json=${request_body} @@ -218,4 +203,3 @@ Create a log entry different aef_id in body ... status=401 ... detail=AEF id not matching in request and body ... cause=Not identical AEF id - diff --git a/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot b/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot index f47385f..a6f9674 100644 --- a/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot +++ b/tests/features/CAPIF Api Provider Management/capif_api_provider_management.robot @@ -64,12 +64,6 @@ Register Api Provider Already registered [Tags] capif_api_provider_management-2 ${register_user_info}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${resp}= Post Request Capif ... /api-provider-management/v1/registrations ... json=${register_user_info['provider_enrollment_details']} @@ -88,12 +82,6 @@ Update Registered Api Provider [Tags] capif_api_provider_management-3 ${register_user_info}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${request_body}= Set Variable ${register_user_info['provider_enrollment_details']} Set To Dictionary ${request_body} apiProvDomInfo=ROBOT_TESTING_MOD @@ -127,12 +115,6 @@ Update Not Registered Api Provider [Tags] capif_api_provider_management-4 ${register_user_info}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${request_body}= Set Variable ${register_user_info['provider_enrollment_details']} ${resp}= Put Request Capif @@ -173,12 +155,6 @@ Partially Update Not Registered Api Provider [Tags] capif_api_provider_management-6 ${register_user_info}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${request_body}= Create Api Provider Enrolment Details Patch Body ${resp}= Patch Request Capif @@ -205,6 +181,8 @@ Delete Registered Api Provider ... verify=ca.crt ... username=${AMF_PROVIDER_USERNAME} + Call Method ${CAPIF_USERS} remove_capif_users_entry ${register_user_info['resource_url'].path} + # Check Results Status Should Be 204 ${resp} @@ -212,12 +190,6 @@ Delete Not Registered Api Provider [Tags] capif_api_provider_management-8 ${register_user_info}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - ${resp}= Delete Request Capif ... /api-provider-management/v1/registrations/${API_PROVIDER_NOT_REGISTERED} ... server=${CAPIF_HTTPS_URL} 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 daef4be..56484d2 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 @@ -1,11 +1,11 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Resource ../../resources/common/basicRequests.robot -Resource ../../resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py +Resource /opt/robot-tests/tests/resources/common.resource +Resource ../../resources/common/basicRequests.robot +Resource ../../resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment *** Variables *** @@ -16,12 +16,9 @@ ${SERVICE_API_ID_NOT_VALID} not-valid *** Test Cases *** Publish API by Authorised API Publisher [Tags] capif_api_publish_service-1 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Test ${request_body}= Create Service Api Description service_1 ${resp}= Post Request Capif @@ -38,12 +35,9 @@ Publish API by Authorised API Publisher Publish API by NON Authorised API Publisher [Tags] capif_api_publish_service-2 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${request_body}= Create Service Api Description ${resp}= Post Request Capif ... /published-apis/v1/${APF_ID_NOT_VALID}/service-apis @@ -60,12 +54,9 @@ Publish API by NON Authorised API Publisher Retrieve all APIs Published by Authorised apfId [Tags] capif_api_publish_service-3 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Register One Service ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -88,12 +79,9 @@ Retrieve all APIs Published by Authorised apfId Retrieve all APIs Published by NON Authorised apfId [Tags] capif_api_publish_service-4 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Retrieve Services published ${resp}= Get Request Capif ... /published-apis/v1/${APF_ID_NOT_VALID}/service-apis @@ -109,12 +97,9 @@ Retrieve all APIs Published by NON Authorised apfId Retrieve single APIs Published by Authorised apfId [Tags] capif_api_publish_service-5 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 @@ -148,19 +133,15 @@ Retrieve single APIs Published by Authorised apfId Retrieve single APIs non Published by Authorised apfId [Tags] capif_api_publish_service-6 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${resp}= Get Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${APF_PROVIDER_USERNAME} - Check Response Variable Type And Values ${resp} 401 ProblemDetails ... title=Unauthorized ... detail=User not authorized @@ -171,9 +152,6 @@ Retrieve single APIs Published by NON Authorised apfId # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Publish Service API ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} @@ -182,9 +160,6 @@ Retrieve single APIs Published by NON Authorised apfId # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${resp}= Get Request Capif ... ${resource_url.path} ... server=${CAPIF_HTTPS_URL} @@ -199,12 +174,9 @@ Retrieve single APIs Published by NON Authorised apfId Update API Published by Authorised apfId with valid serviceApiId [Tags] capif_api_publish_service-8 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 @@ -232,12 +204,9 @@ Update API Published by Authorised apfId with valid serviceApiId Update APIs Published by Authorised apfId with invalid serviceApiId [Tags] capif_api_publish_service-9 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 @@ -257,22 +226,16 @@ Update APIs Published by Authorised apfId with invalid serviceApiId Update APIs Published by NON Authorised apfId [Tags] capif_api_publish_service-10 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Api Description service_1_modified ${resp}= Put Request Capif ... ${resource_url.path} @@ -299,12 +262,9 @@ Update APIs Published by NON Authorised apfId Delete API Published by Authorised apfId with valid serviceApiId [Tags] capif_api_publish_service-11 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${service_api_description_published_1} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... first_service @@ -330,12 +290,9 @@ Delete API Published by Authorised apfId with valid serviceApiId Delete APIs Published by Authorised apfId with invalid serviceApiId [Tags] capif_api_publish_service-12 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${resp}= Delete Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} ... server=${CAPIF_HTTPS_URL} @@ -349,18 +306,12 @@ Delete APIs Published by Authorised apfId with invalid serviceApiId Delete APIs Published by NON Authorised apfId [Tags] capif_api_publish_service-13 - #Register APF + # Register APF ${register_user_info}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - - #Register INVOKER + # Register INVOKER ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${resp}= Delete Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis/${SERVICE_API_ID_NOT_VALID} ... server=${CAPIF_HTTPS_URL} diff --git a/tests/features/CAPIF Security Api/capif_security_api.robot b/tests/features/CAPIF Security Api/capif_security_api.robot index 4e27948..6342aa9 100644 --- a/tests/features/CAPIF Security Api/capif_security_api.robot +++ b/tests/features/CAPIF Security Api/capif_security_api.robot @@ -1,12 +1,12 @@ *** Settings *** -Resource /opt/robot-tests/tests/resources/common.resource -Library /opt/robot-tests/tests/libraries/bodyRequests.py -Library Collections -Resource /opt/robot-tests/tests/resources/common/basicRequests.robot -Resource ../../resources/common.resource +Resource /opt/robot-tests/tests/resources/common.resource +Library /opt/robot-tests/tests/libraries/bodyRequests.py +Library Collections +Resource /opt/robot-tests/tests/resources/common/basicRequests.robot +Resource ../../resources/common.resource -Test Setup Reset Testing Environment -Suite Teardown Reset Testing Environment +Suite Teardown Reset Testing Environment +Test Setup Reset Testing Environment *** Variables *** @@ -22,9 +22,6 @@ Create a security context for an API invoker # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -43,15 +40,9 @@ Create a security context for an API invoker with Provider role # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -73,9 +64,6 @@ Create a security context for an API invoker with Provider entity role and inval # Register APF ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Create Security Context ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif @@ -97,9 +85,6 @@ Create a security context for an API invoker with Invalid apiInvokerID # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} @@ -120,9 +105,6 @@ Retrieve the Security Context of an API Invoker # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -139,9 +121,6 @@ Retrieve the Security Context of an API Invoker # Register APF ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Retrieve Security context can setup by parameters if authenticationInfo and authorizationInfo are needed at response. # ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']}?authenticationInfo=true&authorizationInfo=true ${resp}= Get Request Capif @@ -165,9 +144,6 @@ Retrieve the Security Context of an API Invoker with invalid apiInvokerID # Register APF ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${resp}= Get Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} ... server=${CAPIF_HTTPS_URL} @@ -185,9 +161,6 @@ Retrieve the Security Context of an API Invoker with invalid apfId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -217,9 +190,6 @@ Delete the Security Context of an API Invoker # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -233,9 +203,6 @@ Delete the Security Context of an API Invoker # Register APF ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Remove Security Context ${resp}= Delete Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -263,9 +230,6 @@ Delete the Security Context of an API Invoker with Invoker entity role # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -294,9 +258,6 @@ Delete the Security Context of an API Invoker with Invoker entity role and inval # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${resp}= Delete Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} ... server=${CAPIF_HTTPS_URL} @@ -315,9 +276,6 @@ Delete the Security Context of an API Invoker with invalid apiInvokerID # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${resp}= Delete Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID} ... server=${CAPIF_HTTPS_URL} @@ -336,15 +294,9 @@ Update the Security Context of an API Invoker # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -389,9 +341,6 @@ Update the Security Context of an API Invoker with Provider entity role # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -402,12 +351,9 @@ Update the Security Context of an API Invoker with Provider entity role Check Response Variable Type And Values ${resp} 201 ServiceSecurity - #Register Provider + # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${resp}= Post Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']}/update ... json=${request_body} @@ -424,12 +370,9 @@ Update the Security Context of an API Invoker with Provider entity role Update the Security Context of an API Invoker with AEF entity role and invalid apiInvokerId [Tags] capif_security_api-14 - #Register Provider + # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Post Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID}/update @@ -449,9 +392,6 @@ Update the Security Context of an API Invoker with invalid apiInvokerID # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Post Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID}/update @@ -472,9 +412,6 @@ Revoke the authorization of the API invoker for APIs # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -485,10 +422,6 @@ Revoke the authorization of the API invoker for APIs # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -545,9 +478,6 @@ Revoke the authorization of the API invoker for APIs without valid apfID. # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -563,9 +493,6 @@ Revoke the authorization of the API invoker for APIs without valid apfID. # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - # Revoke Security Context by Invoker ${request_body}= Create Security Notification Body ${register_user_info_invoker['api_invoker_id']} 1234 ${resp}= Post Request Capif @@ -601,9 +528,6 @@ Revoke the authorization of the API invoker for APIs with invalid apiInvokerId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - ${request_body}= Create Service Security Body ${NOTIFICATION_DESTINATION} ${resp}= Put Request Capif ... /capif-security/v1/trustedInvokers/${register_user_info_invoker['api_invoker_id']} @@ -616,12 +540,9 @@ Revoke the authorization of the API invoker for APIs with invalid apiInvokerId ${security_context}= Set Variable ${resp.json()} - #Register Provider + # Register Provider ${register_user_info_publisher}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_publisher['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${request_body}= Create Security Notification Body ${API_INVOKER_NOT_VALID} 1234 ${resp}= Post Request Capif ... /capif-security/v1/trustedInvokers/${API_INVOKER_NOT_VALID}/delete @@ -652,9 +573,6 @@ Retrieve access token # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -665,9 +583,6 @@ Retrieve access token # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -711,9 +626,6 @@ Retrieve access token by Provider # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -724,9 +636,6 @@ Retrieve access token by Provider # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -769,9 +678,6 @@ Retrieve access token by Provider with invalid apiInvokerId # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -782,9 +688,6 @@ Retrieve access token by Provider with invalid apiInvokerId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -828,9 +731,6 @@ Retrieve access token with invalid apiInvokerId # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -841,9 +741,6 @@ Retrieve access token with invalid apiInvokerId # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -889,9 +786,6 @@ Retrieve access token with invalid client_id # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -902,9 +796,6 @@ Retrieve access token with invalid client_id # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -948,9 +839,6 @@ Retrieve access token with unsupported grant_type # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -961,9 +849,6 @@ Retrieve access token with unsupported grant_type # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -1014,9 +899,6 @@ Retrieve access token with invalid scope # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -1027,9 +909,6 @@ Retrieve access token with invalid scope # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -1075,9 +954,6 @@ Retrieve access token with invalid aefid at scope # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -1088,9 +964,6 @@ Retrieve access token with invalid aefid at scope # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -1136,9 +1009,6 @@ Retrieve access token with invalid apiName at scope # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method ${CAPIF_USERS} update_capif_users_dicts ${register_user_info_provider['resource_url'].path} ${AMF_PROVIDER_USERNAME} - - ${api_name}= Set Variable service_1 # Register One Service @@ -1149,9 +1019,6 @@ Retrieve access token with invalid apiName at scope # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding - Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${INVOKER_USERNAME} - - # Test ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api-name=${api_name} @@ -1189,4 +1056,4 @@ Retrieve access token with invalid apiName at scope # Check Results Check Response Variable Type And Values ${resp} 400 AccessTokenErr ... error=invalid_scope - ... error_description=One of the api names does not exist or is not associated with the aef id provided \ No newline at end of file + ... error_description=One of the api names does not exist or is not associated with the aef id provided diff --git a/tests/resources/common/basicRequests.robot b/tests/resources/common/basicRequests.robot index 3a24b84..ea3a96f 100644 --- a/tests/resources/common/basicRequests.robot +++ b/tests/resources/common/basicRequests.robot @@ -5,7 +5,7 @@ Library RequestsLibrary Library Collections Library OperatingSystem Library XML -Library Telnet +Library Telnet *** Variables *** @@ -58,31 +58,31 @@ Create Register Admin Session [Documentation] Create needed session to reach Register as Administrator. [Arguments] ${server}=${NONE} ${access_token}=${NONE} ${verify}=${NONE} ${vault_token}=${NONE} IF "${server}" != "${NONE}" - IF "${access_token}" != "${NONE}" + IF "${access_token}" != "${NONE}" ## Return Header with bearer ${headers}= Create Dictionary Authorization=Bearer ${access_token} - RETURN ${headers} + RETURN ${headers} END - + # Request Admin Login to retrieve access token - Create Session register_session ${server} verify=${verify} disable_warnings=1 + Create Session register_session ${server} verify=${verify} disable_warnings=1 ${auth}= Set variable ${{ ('${REGISTER_ADMIN_USER}','${REGISTER_ADMIN_PASSWORD}') }} - ${resp}= POST On Session register_session /login auth=${auth} + ${resp}= POST On Session register_session /login auth=${auth} Log Dictionary ${resp.json()} - + ## Crear sesiĆ³n con token ${headers}= Create Dictionary Authorization=Bearer ${resp.json()['access_token']} - RETURN ${headers} + RETURN ${headers} END - RETURN ${NONE} ## NEW REQUESTS TO REGISTER + Post Request Admin Register [Timeout] 60s [Arguments] @@ -139,12 +139,8 @@ Get Request Admin Register ... cert=${cert} RETURN ${resp} - - - # NEW REQUESTS END - Post Request Capif [Timeout] 60s [Arguments] @@ -327,8 +323,12 @@ Register User At Jwt Auth END Log cn=${cn} - - ${resp}= Create User At Register ${username} ${password} ${description} email="${username}@nobody.com" + + ${resp}= Create User At Register + ... ${username} + ... ${password} + ... ${description} + ... email="${username}@nobody.com" ${get_auth_response}= Get Auth For User ${username} ${password} @@ -353,7 +353,7 @@ Register User At Jwt Auth Store In File ${username}.key ${register_user_info['private_key']} END - Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} + Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} RETURN ${register_user_info} @@ -372,7 +372,11 @@ Register User At Jwt Auth Provider ${amf_csr_request}= Create User Csr ${amf_username} amf # Register provider - ${resp}= Create User At Register ${username} ${password} ${description} email="${username}@nobody.com" + ${resp}= Create User At Register + ... ${username} + ... ${password} + ... ${description} + ... email="${username}@nobody.com" ${get_auth_response}= Get Auth For User ${username} ${password} @@ -392,59 +396,62 @@ Register User At Jwt Auth Provider Log Dictionary ${register_user_info} - Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} + Call Method ${CAPIF_USERS} update_register_users ${register_user_info['uuid']} ${username} RETURN ${register_user_info} - Login Register Admin - ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} - RETURN ${headers} + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} + RETURN ${headers} Create User At Register - [Documentation] (Administrator) This Keyword create a user at register component. - [Arguments] ${username} ${password} ${description} ${email} - + [Documentation] (Administrator) This Keyword create a user at register component. + [Arguments] ${username} ${password} ${description} ${email} + # Obtain Admin Token to request creation of User ${headers}= Login Register Admin - - &{body}= Create Dictionary username=${username} password=${password} description=${description} email=${email} - ${resp}= Post On Session register_session /createUser headers=${headers} json=${body} + + &{body}= Create Dictionary + ... username=${username} + ... password=${password} + ... description=${description} + ... email=${email} + ${resp}= Post On Session register_session /createUser headers=${headers} json=${body} Should Be Equal As Strings ${resp.status_code} 201 - + RETURN ${resp} Delete User At Register - [Documentation] (Administrator) This Keyword delete a user from register. - [Arguments] ${username}=${NONE} ${uuid}=${NONE} - ${user_uuid}= Set Variable ${uuid} + [Documentation] (Administrator) This Keyword delete a user from register. + [Arguments] ${username}=${NONE} ${uuid}=${NONE} + ${user_uuid}= Set Variable ${uuid} - IF "${username}" != "${NONE}" - ${user_uuid}= Call Method ${CAPIF_USERS} get_user_uuid ${username} + IF "${username}" != "${NONE}" + ${user_uuid}= Call Method ${CAPIF_USERS} get_user_uuid ${username} END - ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False - ${resp}= DELETE On Session register_session /deleteUser/${user_uuid} headers=${headers} + ${resp}= DELETE On Session register_session /deleteUser/${user_uuid} headers=${headers} Should Be Equal As Strings ${resp.status_code} 204 Call Method ${CAPIF_USERS} remove_register_users_entry ${user_uuid} - RETURN ${resp} + RETURN ${resp} Get List of User At Register - [Documentation] (Administrator) This Keyword retrieve a list of users from register. - ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False + [Documentation] (Administrator) This Keyword retrieve a list of users from register. + ${headers}= Create Register Admin Session ${CAPIF_HTTPS_REGISTER_URL} verify=False - ${resp}= DELETE On Session register_session /getUsers headers=${headers} + ${resp}= DELETE On Session register_session /getUsers headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 - RETURN ${resp.json()['users']} + RETURN ${resp.json()['users']} Get Auth For User - [Documentation] (User) This Keyword retrieve token to be used by user towards first interaction with CCF. + [Documentation] (User) This Keyword retrieve token to be used by user towards first interaction with CCF. [Arguments] ${username} ${password} ${auth}= Set variable ${{ ('${username}','${password}') }} ${resp}= GET On Session register_session /getauth auth=${auth} @@ -475,11 +482,11 @@ Clean Test Information ${uuids}= Get Dictionary Keys ${register_users_dict} FOR ${uuid} IN @{uuids} - Delete User At Register uuid=${uuid} + Delete User At Register uuid=${uuid} END Remove entity - [Arguments] ${entity_user} ${certificate_name}=${entity_user} + [Arguments] ${entity_user} ${certificate_name}=${entity_user} ${capif_users_dict}= Call Method ${CAPIF_USERS} get_capif_users_dict @@ -491,7 +498,7 @@ Remove entity FOR ${key} IN @{keys} ${value}= Get From Dictionary ${capif_users_dict} ${key} - IF "${value}" == "${certificate_name}" + IF "${value}" == "${certificate_name}" ${resp}= Delete Request Capif ... ${key} ... server=${CAPIF_HTTPS_URL} @@ -503,14 +510,14 @@ Remove entity Call Method ${CAPIF_USERS} remove_capif_users_entry ${key} END END - - Delete User At Register username=${entity_user} + + Delete User At Register username=${entity_user} Log Dictionary ${capif_users_dict} Log Dictionary ${register_users_dict} Remove Resource - [Arguments] ${resource_url} ${management_cert} ${username} + [Arguments] ${resource_url} ${management_cert} ${username} ${resp}= Delete Request Capif ... ${resource_url} @@ -530,7 +537,6 @@ Remove Resource Should Be Equal As Strings ${resp.status_code} 204 - Invoker Default Onboarding [Arguments] ${invoker_username}=${INVOKER_USERNAME} ${register_user_info}= Register User At Jwt Auth @@ -554,11 +560,12 @@ Invoker Default Onboarding # Assertions Status Should Be 201 ${resp} Check Variable ${resp.json()} APIInvokerEnrolmentDetails - ${resource_url}= Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} + ${resource_url}= Check Location Header ${resp} ${LOCATION_INVOKER_RESOURCE_REGEX} # Store dummy signede certificate Store In File ${invoker_username}.crt ${resp.json()['onboardingInformation']['apiInvokerCertificate']} ${url}= Parse Url ${resp.headers['Location']} + Call Method ${CAPIF_USERS} update_capif_users_dicts ${url.path} ${invoker_username} Set To Dictionary ${register_user_info} resource_url=${resource_url} Set To Dictionary ${register_user_info} management_cert=${invoker_username} @@ -622,6 +629,12 @@ Provider Registration ... provider_register_response=${resp} ... management_cert=${register_user_info['amf_username']} + Call Method + ... ${CAPIF_USERS} + ... update_capif_users_dicts + ... ${register_user_info['resource_url'].path} + ... ${register_user_info['amf_username']} + RETURN ${register_user_info} Provider Default Registration @@ -633,6 +646,7 @@ Provider Default Registration ${register_user_info}= Provider Registration ${register_user_info} Log Dictionary ${register_user_info} + RETURN ${register_user_info} Publish Service Api @@ -657,13 +671,6 @@ Basic ACL registration # Register APF ${register_user_info_provider}= Provider Default Registration - Call Method - ... ${CAPIF_USERS} - ... update_capif_users_dicts - ... ${register_user_info_provider['resource_url'].path} - ... ${AMF_PROVIDER_USERNAME} - Call Method ${CAPIF_USERS} update_register_users ${register_user_info_provider['uuid']} ${PROVIDER_USERNAME} - ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info_provider} ... service_1 @@ -714,7 +721,7 @@ Basic ACL registration RETURN ${register_user_info_invoker} ${register_user_info_provider} ${service_api_description_published} Create Security Context Between invoker and provider - [Arguments] ${register_user_info_invoker} ${register_user_info_provider} + [Arguments] ${register_user_info_invoker} ${register_user_info_provider} ${discover_response}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info_provider['aef_id']} @@ -737,4 +744,3 @@ Create Security Context Between invoker and provider ... username=${register_user_info_invoker['management_cert']} Check Response Variable Type And Values ${resp} 201 ServiceSecurity - -- GitLab