Loading tests/features/CAPIF Api Open Discover Service/__init__.robot 0 → 100644 +2 −0 Original line number Diff line number Diff line *** Settings *** Force Tags capif_api_open_discover_service No newline at end of file tests/features/CAPIF Api Open Discover Service/capif_api_service_open_discover.robot 0 → 100644 +46 −0 Original line number Diff line number Diff line *** 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 Suite Teardown Reset Testing Environment Test Setup Reset Testing Environment Test Teardown Reset Testing Environment *** Variables *** ${API_INVOKER_NOT_REGISTERED} not-valid *** Test Cases *** Open Discover Published service APIs by Authorised Entity [Tags] capif_api_open_discover_service-1 # Register APF ${register_user_info}= Provider Default Registration # Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} # Register user for invoker ${register_user_info}= Register User At Jwt Auth ... username=${INVOKER_USERNAME} role=${INVOKER_ROLE} # Test ${resp}= Get Request Capif ... ${OPEN_DISCOVER_URL} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... access_token=${register_user_info['access_token']} Check Response Variable Type And Values ${resp} 200 OpenDiscoveryResp # Check Results Dictionary Should Contain Key ${resp.json()} discApis Should Not Be Empty ${resp.json()['discApis']} Length Should Be ${resp.json()['discApis']} 1 # Convert Service API Description to Open API Details ${open_api_details}= Create Open API Details From Service API Description ${service_api_description_published} List Should Contain Value ${resp.json()['discApis']} ${open_api_details} tests/libraries/common/types.json +36 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,42 @@ "suppFeat": "SupportedFeatures" } }, "OpenDiscoveryResp": { "mandatory_attributes": { "discApis": "OpenAPIDetails" }, "optional_attributes": { "suppFeat": "SupportedFeatures" } }, "OpenAPIDetails": { "mandatory_attributes": { "apiName": "string" }, "optional_attributes": { "apiId": "string", "apiStatus": "ApiStatus", "description": "string", "serviceAPICategory": "string", "apiSuppFeats": "SupportedFeatures", "apiProvName": "string", "aefProfiles": "OpenAefProfile" } }, "OpenAefProfile": { "mandatory_attributes": {}, "optional_attributes": { "aefId": "string", "versions": "Version", "protocol": "Protocol", "dataFormat": "DataFormat", "aefLocation": "AefLocation", "serviceKpis": "ServiceKpis" }, "regex_attributes": { "^vendorSpecific-(.*)": "VendorSpecificObject" } }, "ServiceSecurity": { "mandatory_attributes": { "securityInfo": "SecurityInformation", Loading tests/libraries/helpers.py +35 −0 Original line number Diff line number Diff line Loading @@ -177,3 +177,38 @@ def filter_users_by_prefix_username(users, prefix): if user['username'].startswith(prefix): filtered_users.append(user['username']) return filtered_users def create_open_api_details_from_service_api_description( service_api_description): filtered_fields = ['apiName', 'apiId', 'apiStatus', 'description', 'serviceAPICategory', 'apiSuppFeats', 'apiProvName', 'aefProfiles'] open_api_details = {} for field in filtered_fields: if field in service_api_description: if field == 'aefProfiles' and field in service_api_description: open_aef_profiles = [] for aef_profile in service_api_description[field]: open_aef_profile = create_open_aef_profile_from_aef_profile(aef_profile) open_aef_profiles.append(open_aef_profile) print('open_aef_profile=' + str(open_aef_profile)) open_api_details[field] = open_aef_profiles else: open_api_details[field] = service_api_description[field] return open_api_details def create_open_aef_profile_from_aef_profile(aef_profile): filtered_fields = ['aefId', 'versions', 'protocol', 'dataFormat', 'aefLocation', 'serviceKpis'] open_aef_profile = {} for field in filtered_fields: if field in aef_profile: open_aef_profile[field] = aef_profile[field] return open_aef_profile tests/resources/common.resource +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ ${NOTIFICATION_DESTINATION_URL} ${MOCK_SERVER_URL} ${DISCOVER_URL} /service-apis/v1/allServiceAPIs?api-invoker-id= ${OPEN_DISCOVER_URL} /open-api-disc/v1/service-apis *** Keywords *** Loading Loading
tests/features/CAPIF Api Open Discover Service/__init__.robot 0 → 100644 +2 −0 Original line number Diff line number Diff line *** Settings *** Force Tags capif_api_open_discover_service No newline at end of file
tests/features/CAPIF Api Open Discover Service/capif_api_service_open_discover.robot 0 → 100644 +46 −0 Original line number Diff line number Diff line *** 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 Suite Teardown Reset Testing Environment Test Setup Reset Testing Environment Test Teardown Reset Testing Environment *** Variables *** ${API_INVOKER_NOT_REGISTERED} not-valid *** Test Cases *** Open Discover Published service APIs by Authorised Entity [Tags] capif_api_open_discover_service-1 # Register APF ${register_user_info}= Provider Default Registration # Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} # Register user for invoker ${register_user_info}= Register User At Jwt Auth ... username=${INVOKER_USERNAME} role=${INVOKER_ROLE} # Test ${resp}= Get Request Capif ... ${OPEN_DISCOVER_URL} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... access_token=${register_user_info['access_token']} Check Response Variable Type And Values ${resp} 200 OpenDiscoveryResp # Check Results Dictionary Should Contain Key ${resp.json()} discApis Should Not Be Empty ${resp.json()['discApis']} Length Should Be ${resp.json()['discApis']} 1 # Convert Service API Description to Open API Details ${open_api_details}= Create Open API Details From Service API Description ${service_api_description_published} List Should Contain Value ${resp.json()['discApis']} ${open_api_details}
tests/libraries/common/types.json +36 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,42 @@ "suppFeat": "SupportedFeatures" } }, "OpenDiscoveryResp": { "mandatory_attributes": { "discApis": "OpenAPIDetails" }, "optional_attributes": { "suppFeat": "SupportedFeatures" } }, "OpenAPIDetails": { "mandatory_attributes": { "apiName": "string" }, "optional_attributes": { "apiId": "string", "apiStatus": "ApiStatus", "description": "string", "serviceAPICategory": "string", "apiSuppFeats": "SupportedFeatures", "apiProvName": "string", "aefProfiles": "OpenAefProfile" } }, "OpenAefProfile": { "mandatory_attributes": {}, "optional_attributes": { "aefId": "string", "versions": "Version", "protocol": "Protocol", "dataFormat": "DataFormat", "aefLocation": "AefLocation", "serviceKpis": "ServiceKpis" }, "regex_attributes": { "^vendorSpecific-(.*)": "VendorSpecificObject" } }, "ServiceSecurity": { "mandatory_attributes": { "securityInfo": "SecurityInformation", Loading
tests/libraries/helpers.py +35 −0 Original line number Diff line number Diff line Loading @@ -177,3 +177,38 @@ def filter_users_by_prefix_username(users, prefix): if user['username'].startswith(prefix): filtered_users.append(user['username']) return filtered_users def create_open_api_details_from_service_api_description( service_api_description): filtered_fields = ['apiName', 'apiId', 'apiStatus', 'description', 'serviceAPICategory', 'apiSuppFeats', 'apiProvName', 'aefProfiles'] open_api_details = {} for field in filtered_fields: if field in service_api_description: if field == 'aefProfiles' and field in service_api_description: open_aef_profiles = [] for aef_profile in service_api_description[field]: open_aef_profile = create_open_aef_profile_from_aef_profile(aef_profile) open_aef_profiles.append(open_aef_profile) print('open_aef_profile=' + str(open_aef_profile)) open_api_details[field] = open_aef_profiles else: open_api_details[field] = service_api_description[field] return open_api_details def create_open_aef_profile_from_aef_profile(aef_profile): filtered_fields = ['aefId', 'versions', 'protocol', 'dataFormat', 'aefLocation', 'serviceKpis'] open_aef_profile = {} for field in filtered_fields: if field in aef_profile: open_aef_profile[field] = aef_profile[field] return open_aef_profile
tests/resources/common.resource +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ ${NOTIFICATION_DESTINATION_URL} ${MOCK_SERVER_URL} ${DISCOVER_URL} /service-apis/v1/allServiceAPIs?api-invoker-id= ${OPEN_DISCOVER_URL} /open-api-disc/v1/service-apis *** Keywords *** Loading