Loading TP/NGSI-LD/Interoperability/Consumption/Entity/QueryEntities/IOP_CNF_01_01.robot 0 → 100644 +102 −0 Original line number Diff line number Diff line *** Settings *** Documentation Verify that the entities found in b2 and b3 can be queried from b1.Verify that the broker b2 mirrors the information stored in the b1 broker and broker b3 contains some exclusive data. Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Context Source Registrations Test Teardown Delete Entities and Delete Registrations *** Variables *** ${first_entity_payload_filename} interoperability/offstreet-parking1-full.jsonld ${second_entity_payload_filename} interoperability/offstreet-parking2-full.jsonld ${third_entity_payload_filename} interoperability/offstreet-parking2-no-location-and-totalspotsnumber.jsonld ${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld ${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld ${b1_url} ${b2_url} ${b3_url} *** Test Cases *** IOP_CNF_01_01 Create Entity In B1 And Query Entity In All Brokers [Documentation] Check that entities can be queried from all brokers. [Tags] 6_3 I6_3_1_1 inclusive exclusive interoperability ${response}= Query Entities entity_types=OffstreetParking broker_url=${b1_url} Check Response Status Code 200 ${response.status_code} @{payload}= Set Variable ${response.json()} Should Contain ${payload}\[OffstreetParking1] availableSpotsNumber Should Contain ${payload}\[OffstreetParking1] totalSpotsNumber ${response}= Query Entities entity_types=OffstreetParking broker_url=${b2_url} @{first_expected_payload}= Set Variable ${response.json()} ${entity_ids}= Create List ${entity_id} ${second_entity_id} Check Response Body Containing Entities URIS set to ${entity_ids} ${response.json()} ${response}= Query Entities entity_types=OffstreetParking broker_url=${b3_url} @{second_expected_payload}= Set Variable ${response.json()} ${entity_ids}= Create List ${entity_id} Check Response Body Containing Entities URIS set to ${entity_ids} ${response.json()} Should Be Equal ${payload}\[OffstreetParking1] ${first_expected_payload}\[OffstreetParking1] Should Contain ${payload}\[OffstreetParking2] ${first_expected_payload}\[OffstreetParking2][totalSpotsNumber] Should Contain ${payload}\[OffstreetParking2] ${second_expected_payload}\[OffstreetParking2][location] *** Keywords *** Setup Initial Context Source Registrations ${entity_id}= Generate Random Parking Entity Id Set Suite Variable ${entity_id} ${second_entity_id}= Generate Random Parking Entity Id Set Suite Variable ${second_entity_id} ${response}= Create Entity ${first_entity_payload_filename} ${entity_id} broker_url=${b2_url} Check Response Status Code 201 ${response.status_code} ${response}= Create Entity ${third_entity_payload_filename} ${second_entity_id} broker_url=${b2_url} Check Response Status Code 201 ${response.status_code} ${response}= Create Entity ${second_entity_payload_filename} ${entity_id} broker_url=${b3_url} Check Response Status Code 201 ${response.status_code} ${registration_id1}= Generate Random CSR Id Set Suite Variable ${registration_id1} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id1} ... ${inclusive_registration_payload_file_path} ... entity_id=${entity_id} ... broker_url=${b2_url} ... mode=inclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id2} ... ${inclusive_registration_payload_file_path} ... entity_id=${second_entity_id} ... broker_url=${b2_url} ... mode=inclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} ${registration_id3}= Generate Random CSR Id Set Suite Variable ${registration_id3} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id3} ... ${exclusive_registration_payload_file_path} ... entity_id=${entity_id} ... broker_url=${b3_url} ... mode=exclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} Delete Entities And Delete Registrations Delete Context Source Registration ${registration_id1} broker_url=${b1_url} Delete Context Source Registration ${registration_id2} broker_url=${b1_url} Delete Context Source Registration ${registration_id3} broker_url=${b1_url} Delete Entity By Id ${entity_id} broker_url=${b2_url} Delete Entity by Id ${second_entity_id} broker_url=${b2_url} Delete Entity By Id ${entity_id} broker_url=${b3_url} No newline at end of file resources/ApiUtils/ContextInformationConsumption.resource +3 −1 Original line number Diff line number Diff line Loading @@ -46,11 +46,13 @@ Query Entities ... ${datasetId}=${EMPTY} ... ${join}=${EMPTY} ... ${joinLevel}=${EMPTY} ... ${broker_url}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${accept_length}= Get Length ${accept} ${options_length}= Get Length ${options} ${entity_ids_length}= Get Length ${entity_ids} ${entity_types_length}= Get Length ${entity_types} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary &{params}= Create Dictionary IF ${accept_length}>0 Loading Loading @@ -99,7 +101,7 @@ Query Entities END ${response}= GET ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... headers=${headers} ... params=${params} ... expected_status=any Loading resources/ApiUtils/ContextInformationProvision.resource +6 −4 Original line number Diff line number Diff line Loading @@ -151,14 +151,15 @@ Batch Upsert Entities RETURN ${response} Create Entity [Arguments] ${filename} ${entity_id} ${local}=${EMPTY} [Arguments] ${filename} ${entity_id} ${local}=${EMPTY} ${broker_url}=${EMPTY} &{params}= Create Dictionary IF '${local}'!='' Set To Dictionary ${params} local=${local} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... json=${entity} ... params=${params} ... headers=${headers} Loading Loading @@ -207,11 +208,12 @@ Create Entity Selecting Content Type RETURN ${response} Create Entity From File [Arguments] ${filename} [Arguments] ${filename} ${broker_url}=${EMPTY} ${file_content}= Get File ${EXECDIR}/data/entities/${filename} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... data=${file_content} ... headers=${headers} ... expected_status=any Loading resources/ApiUtils/ContextSourceRegistration.resource +12 −7 Original line number Diff line number Diff line Loading @@ -31,9 +31,11 @@ Prepare Context Source Registration From File ... ${entity_id_pattern}=${EMPTY} ... ${mode}=${EMPTY} ... ${endpoint}=${EMPTY} ... ${broker_url}=${EMPTY} ... ${operations}=[] ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${final_context_source_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${context_source_url} ${registration_payload}= Update Value To JSON ... ${payload} ... $.id Loading @@ -41,7 +43,7 @@ Prepare Context Source Registration From File ${registration_payload}= Update Value To JSON ... ${registration_payload} ... $..endpoint ... ${context_source_url}${endpoint} ... ${final_context_source_url}${endpoint} IF '${entity_id}' != '' ${dict}= Create Dictionary id=${entity_id} ${registration_payload}= Add Object To JSON Loading Loading @@ -85,8 +87,9 @@ Create Context Source Registration RETURN ${response} Create Context Source Registration With Return [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} ${broker_url}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} IF '${accept}'!='' Set To Dictionary ${headers} Accept=${context} END Loading @@ -97,7 +100,7 @@ Create Context Source Registration With Return ... Link=${context_link} END ${response}= POST ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} ... json=${payload} ... headers=${headers} ... expected_status=any Loading @@ -105,16 +108,18 @@ Create Context Source Registration With Return RETURN ${response} Delete Context Source Registration [Arguments] ${context_source_registration_id} [Arguments] ${context_source_registration_id} ${broker_url}=${EMPTY} ${response}= DELETE url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} ${response}= DELETE url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} Output ${response} Delete Context Source Registration RETURN ${response} Delete Context Source Registration With Return [Arguments] ${registration_id} [Arguments] ${registration_id} ${broker_url}=${EMPTY} ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} ${response}= DELETE ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} ... expected_status=any Output ${response} Delete Context Source Registration RETURN ${response} Loading Loading
TP/NGSI-LD/Interoperability/Consumption/Entity/QueryEntities/IOP_CNF_01_01.robot 0 → 100644 +102 −0 Original line number Diff line number Diff line *** Settings *** Documentation Verify that the entities found in b2 and b3 can be queried from b1.Verify that the broker b2 mirrors the information stored in the b1 broker and broker b3 contains some exclusive data. Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Context Source Registrations Test Teardown Delete Entities and Delete Registrations *** Variables *** ${first_entity_payload_filename} interoperability/offstreet-parking1-full.jsonld ${second_entity_payload_filename} interoperability/offstreet-parking2-full.jsonld ${third_entity_payload_filename} interoperability/offstreet-parking2-no-location-and-totalspotsnumber.jsonld ${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld ${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld ${b1_url} ${b2_url} ${b3_url} *** Test Cases *** IOP_CNF_01_01 Create Entity In B1 And Query Entity In All Brokers [Documentation] Check that entities can be queried from all brokers. [Tags] 6_3 I6_3_1_1 inclusive exclusive interoperability ${response}= Query Entities entity_types=OffstreetParking broker_url=${b1_url} Check Response Status Code 200 ${response.status_code} @{payload}= Set Variable ${response.json()} Should Contain ${payload}\[OffstreetParking1] availableSpotsNumber Should Contain ${payload}\[OffstreetParking1] totalSpotsNumber ${response}= Query Entities entity_types=OffstreetParking broker_url=${b2_url} @{first_expected_payload}= Set Variable ${response.json()} ${entity_ids}= Create List ${entity_id} ${second_entity_id} Check Response Body Containing Entities URIS set to ${entity_ids} ${response.json()} ${response}= Query Entities entity_types=OffstreetParking broker_url=${b3_url} @{second_expected_payload}= Set Variable ${response.json()} ${entity_ids}= Create List ${entity_id} Check Response Body Containing Entities URIS set to ${entity_ids} ${response.json()} Should Be Equal ${payload}\[OffstreetParking1] ${first_expected_payload}\[OffstreetParking1] Should Contain ${payload}\[OffstreetParking2] ${first_expected_payload}\[OffstreetParking2][totalSpotsNumber] Should Contain ${payload}\[OffstreetParking2] ${second_expected_payload}\[OffstreetParking2][location] *** Keywords *** Setup Initial Context Source Registrations ${entity_id}= Generate Random Parking Entity Id Set Suite Variable ${entity_id} ${second_entity_id}= Generate Random Parking Entity Id Set Suite Variable ${second_entity_id} ${response}= Create Entity ${first_entity_payload_filename} ${entity_id} broker_url=${b2_url} Check Response Status Code 201 ${response.status_code} ${response}= Create Entity ${third_entity_payload_filename} ${second_entity_id} broker_url=${b2_url} Check Response Status Code 201 ${response.status_code} ${response}= Create Entity ${second_entity_payload_filename} ${entity_id} broker_url=${b3_url} Check Response Status Code 201 ${response.status_code} ${registration_id1}= Generate Random CSR Id Set Suite Variable ${registration_id1} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id1} ... ${inclusive_registration_payload_file_path} ... entity_id=${entity_id} ... broker_url=${b2_url} ... mode=inclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id2} ... ${inclusive_registration_payload_file_path} ... entity_id=${second_entity_id} ... broker_url=${b2_url} ... mode=inclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} ${registration_id3}= Generate Random CSR Id Set Suite Variable ${registration_id3} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id3} ... ${exclusive_registration_payload_file_path} ... entity_id=${entity_id} ... broker_url=${b3_url} ... mode=exclusive ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} Check Response Status Code 201 ${response.status_code} Delete Entities And Delete Registrations Delete Context Source Registration ${registration_id1} broker_url=${b1_url} Delete Context Source Registration ${registration_id2} broker_url=${b1_url} Delete Context Source Registration ${registration_id3} broker_url=${b1_url} Delete Entity By Id ${entity_id} broker_url=${b2_url} Delete Entity by Id ${second_entity_id} broker_url=${b2_url} Delete Entity By Id ${entity_id} broker_url=${b3_url} No newline at end of file
resources/ApiUtils/ContextInformationConsumption.resource +3 −1 Original line number Diff line number Diff line Loading @@ -46,11 +46,13 @@ Query Entities ... ${datasetId}=${EMPTY} ... ${join}=${EMPTY} ... ${joinLevel}=${EMPTY} ... ${broker_url}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${accept_length}= Get Length ${accept} ${options_length}= Get Length ${options} ${entity_ids_length}= Get Length ${entity_ids} ${entity_types_length}= Get Length ${entity_types} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary &{params}= Create Dictionary IF ${accept_length}>0 Loading Loading @@ -99,7 +101,7 @@ Query Entities END ${response}= GET ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... headers=${headers} ... params=${params} ... expected_status=any Loading
resources/ApiUtils/ContextInformationProvision.resource +6 −4 Original line number Diff line number Diff line Loading @@ -151,14 +151,15 @@ Batch Upsert Entities RETURN ${response} Create Entity [Arguments] ${filename} ${entity_id} ${local}=${EMPTY} [Arguments] ${filename} ${entity_id} ${local}=${EMPTY} ${broker_url}=${EMPTY} &{params}= Create Dictionary IF '${local}'!='' Set To Dictionary ${params} local=${local} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... json=${entity} ... params=${params} ... headers=${headers} Loading Loading @@ -207,11 +208,12 @@ Create Entity Selecting Content Type RETURN ${response} Create Entity From File [Arguments] ${filename} [Arguments] ${filename} ${broker_url}=${EMPTY} ${file_content}= Get File ${EXECDIR}/data/entities/${filename} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... data=${file_content} ... headers=${headers} ... expected_status=any Loading
resources/ApiUtils/ContextSourceRegistration.resource +12 −7 Original line number Diff line number Diff line Loading @@ -31,9 +31,11 @@ Prepare Context Source Registration From File ... ${entity_id_pattern}=${EMPTY} ... ${mode}=${EMPTY} ... ${endpoint}=${EMPTY} ... ${broker_url}=${EMPTY} ... ${operations}=[] ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${final_context_source_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${context_source_url} ${registration_payload}= Update Value To JSON ... ${payload} ... $.id Loading @@ -41,7 +43,7 @@ Prepare Context Source Registration From File ${registration_payload}= Update Value To JSON ... ${registration_payload} ... $..endpoint ... ${context_source_url}${endpoint} ... ${final_context_source_url}${endpoint} IF '${entity_id}' != '' ${dict}= Create Dictionary id=${entity_id} ${registration_payload}= Add Object To JSON Loading Loading @@ -85,8 +87,9 @@ Create Context Source Registration RETURN ${response} Create Context Source Registration With Return [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} ${broker_url}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} ${final_url}= Set Variable If '${broker_url}'!='' ${broker_url} ${url} IF '${accept}'!='' Set To Dictionary ${headers} Accept=${context} END Loading @@ -97,7 +100,7 @@ Create Context Source Registration With Return ... Link=${context_link} END ${response}= POST ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} ... json=${payload} ... headers=${headers} ... expected_status=any Loading @@ -105,16 +108,18 @@ Create Context Source Registration With Return RETURN ${response} Delete Context Source Registration [Arguments] ${context_source_registration_id} [Arguments] ${context_source_registration_id} ${broker_url}=${EMPTY} ${response}= DELETE url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} ${response}= DELETE url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} Output ${response} Delete Context Source Registration RETURN ${response} Delete Context Source Registration With Return [Arguments] ${registration_id} [Arguments] ${registration_id} ${broker_url}=${EMPTY} ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} ${response}= DELETE ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} ... expected_status=any Output ${response} Delete Context Source Registration RETURN ${response} Loading