Loading tests/features/CAPIF Security Api/capif_security_api.robot +9 −9 Original line number Diff line number Diff line Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading tests/libraries/helpers.py +13 −0 Original line number Diff line number Diff line Loading @@ -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): Loading Loading @@ -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) tests/requirements.txt +2 −1 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ configparser==5.3.0 redis==4.3.4 rfc3987==1.3.8 robotframework-httpctrl robotframework-archivelibrary == 0.4.2 No newline at end of file tests/resources/common/basicRequests.robot +57 −11 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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} Loading @@ -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 Loading Loading @@ -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} Loading Loading @@ -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 tests/tasks/Dummy Info/__init__.robot 0 → 100644 +2 −0 Original line number Diff line number Diff line *** Settings *** Force Tags populate No newline at end of file Loading
tests/features/CAPIF Security Api/capif_security_api.robot +9 −9 Original line number Diff line number Diff line Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading Loading @@ -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} Loading
tests/libraries/helpers.py +13 −0 Original line number Diff line number Diff line Loading @@ -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): Loading Loading @@ -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)
tests/requirements.txt +2 −1 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ configparser==5.3.0 redis==4.3.4 rfc3987==1.3.8 robotframework-httpctrl robotframework-archivelibrary == 0.4.2 No newline at end of file
tests/resources/common/basicRequests.robot +57 −11 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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} Loading @@ -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 Loading Loading @@ -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} Loading Loading @@ -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
tests/tasks/Dummy Info/__init__.robot 0 → 100644 +2 −0 Original line number Diff line number Diff line *** Settings *** Force Tags populate No newline at end of file