diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot index a9d3a691eaf2530d62a1c1afebbb9670064c8145..47a71624048714d6edc675cec49555803a6c6e6d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -17,9 +17,9 @@ Test Template Create Entity With Invalid Request Scenarios 001_02_03 EntityWithNoContext [Tags] e-create 5_6_1 building-minimal.json ${ERROR_TYPE_BAD_REQUEST_DATA} -001_02_04 EntityWithNoContext +001_02_04 EntityWithInvalidType [Tags] e-create 5_6_1 - invalid-type.jsonld ${ERROR_TYPE_INVALID_REQUEST} + invalid-type.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot index acd4e36cc07691cde055a4eb61bc25d0e7b43730..6ff061b98fa75303eda3d11f075f189b72944121 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot @@ -31,7 +31,7 @@ ${building_filename}= building-location-attribute.jsonld Should be Equal ${subscription_id} ${notification}[subscriptionId] Length Should Be ${notification}[data] ${1} ${notified_entity}= Set Variable ${notification}[data][0] - Length Should Be ${notified_entity} ${4} + Length Should Be ${notified_entity} ${5} Should be Equal ${entity_id} ${notified_entity}[id] Should Have Value In Json ... json_object=${notified_entity} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..4a7f20202639ce55071a1cb5b6f504d273b6ae98 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker and a fragment of an entity on a Context Source, if one queries the Context Broker the query gets merged with the Context Source correctly + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +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 +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + + +*** Test Cases *** +D011_01_exc Query The Context Broker With Type + [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_2 + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply GET /broker1/ngsi-ld/v1/entities?type=Vehicle 200 ${entity_speed} + + ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + +*** Keywords *** +Create Entity And Setup Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity by Id ${entity_id} + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..d4a2519cf2a41c97289999ca8033ebe7b7cfe939 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Verify that an entity can be retrieved by Id with a queryEntity and a queryBatch while using an exclusive registration. +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D011_02_01_exc Query The Context Broker By Id using the queryEntity operation + [Documentation] Check that if one queries the Context Broker for type, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_2 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type + queryEntity GET /broker1/ngsi-ld/v1/entities?type=Vehicle + +D011_02_02_exc Query The Context Broker By Id using the queryBatch operation + [Documentation] Check that if one queries the Context Broker for type, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_2 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type + queryBatch POST /broker1/ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Query The Context Broker With Type + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Vehicle Entity Id + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${operations}= Create List ${operation} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ... operations=${operations} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_speed} + @{entities_id}= Create List ${entity_id} + ${response}= Query Entities entity_ids=${entities_id} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..00e313dc856e22de4133fbf998abb65fdfde3190 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_exc.robot @@ -0,0 +1,73 @@ +*** Settings *** +Documentation Verify that an entity can be retrieved by Id via POST with a queryEntity and a queryBatch while using an exclusive registration. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D0011_03_01_exc Query The Context Broker By Id Via POST using the queryEntity operation + [Documentation] Check that if one queries the Context Broker for type via GET, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryEntity GET /broker1/ngsi-ld/v1/entities?type=Vehicle + +D011_03_02_exc Query The Context Broker By Id Via POST using the queryBatch operation + [Documentation] Check that if one queries the Context Broker for type via POST, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryBatch POST /broker1/ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + ${operations}= Create List ${operation} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ... operations=${operations} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + Start Context Source Mock Server + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_speed} + &{entities}= Create Dictionary + Set To Dictionary ${entities} id=${entity_id} + @{entities}= Create List ${entities} + ${response}= Query Entities Via POST entities=${entities} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + @{entities_id}= Create List ${entity_id} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..5da219f2e8b6d75799552218fa9bef81003cd33f --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_exc.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, a retrieval request to the Context Broker the request is forwarded correcty to the Context Source + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D010_01_exc Query Context Broker And Retrieve Entity By Id + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the retrieveEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_1 + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply GET /broker1/ngsi-ld/v1/entities/${entity_id} 200 ${entity_speed} + + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + +*** Keywords *** +Create Entity And Setup Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..e52e4767c65d703ccd62ace0e5b5281d33bc51a0 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_exc.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker and part of an entity on a Context Source, a retrieval request to the Context Broker does not contain the exclusive attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D010_02_exc Query Context Broker And Retrieve Entity By Id + [Documentation] Check that if one retrieves a fragmented entity locally, the response does not contain the exclusive attribute + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_1 + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply GET /broker1/ngsi-ld/v1/entities/${entity_id} 200 ${entity_speed} + + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} local=${True} + Dictionary Should Not Contain Key ${response.json()} speed + +*** Keywords *** +Create Entity And Setup Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..ec2c2f2ad0fb4e1ffb4fc5b24eeedd82f67a957a --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_exc.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, a retrieval request to the Context Broker the request is forwarded correcty to the Context Source using the appropriate operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Retrieve Entity +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D010_03_01_exc Retrieve Entity By Id Using The retrieveEntity Operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration allows the retrieveEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + retrieveEntity GET /broker1/ngsi-ld/v1/entities/ + +D010_03_02_exc Retrieve Entity By Id Using The queryEntity Operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + queryEntity GET /broker1/ngsi-ld/v1/entities?type=Vehicle +D010_03_03_exc Retrieve Entity By Id Using The queryBatch Operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + queryBatch POST /broker1/ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Retrieve Entity + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Vehicle Entity Id + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + IF '${operation}' == 'retrieveEntity' + ${url}= Set Variable ${url}${entity_id} + END + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${operations}= Create List ${operation} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ... operations=${operations} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_speed} + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b1798060b56ef16a88b88829b549d2cad3f63e69 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps"], + "endpoint": "http://my.csource.org:1026/", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/vehicle-speed-attribute.json b/data/entities/vehicle-speed-attribute.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a2fdc03d0550292b920280ac7b0d5f0c556872 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.json @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + } + } +} \ No newline at end of file diff --git a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld index 88d10bcb0844accc8e20368b6c26190217ad39eb..ba572931713a212efefd3b5df4bccb08b74e53e0 100644 --- a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld +++ b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld @@ -1,6 +1,6 @@ { "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld" ] }