From bef40610ef0ae0b0088a14794711f4d243655738 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 28 Oct 2025 11:51:10 +0100 Subject: [PATCH 1/4] feat: implement test for inclusive --- .../PartialAttributeUpdate/D005_01_inc.robot | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot new file mode 100644 index 00000000..f5d4b252 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Check that, given an inclusive registration, partially updating an entity updates the Context Source accordingly. + +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_payload_filename} vehicle-simple-different-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-01-fragment.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${attribute_id} speed + +*** Test Cases *** +D005_01_inc Partial Partial Attribute Update + [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches an inclusive registration, this is updated on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 + + Set Stub Reply PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 + ${response}= Partial Update Entity Attributes + ... ${entity_id} + ... ${attribute_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Wait For Request + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} + Should Be True ${stub_count} > 0 + +*** 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} + 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=inclusive + ${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 -- GitLab From 6da3f9dfbe7cf7e2d8e01f81df1725ac92bdcdf8 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 28 Oct 2025 12:47:46 +0100 Subject: [PATCH 2/4] feat: implement test for exclusive --- .../PartialAttributeUpdate/D005_01_exc.robot | 63 +++++++++++++++++++ ...t-source-registration-vehicle-speed.jsonld | 21 +++++++ 2 files changed, 84 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot new file mode 100644 index 00000000..254ed3cf --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that, given an exclusive registration, partially updating an entity updates the Context Source accordingly. + +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_payload_filename} vehicle-simple-different-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-01-fragment.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld +${attribute_id} speed + +*** Test Cases *** +D005_01_exc Partial Partial Attribute Update + [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches an exclusive registration, this is updated on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_6_2 + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 + ${response}= Partial Update Entity Attributes + ... ${entity_id} + ... ${attribute_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Wait For Request + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} + Should Be True ${stub_count} > 0 + +*** 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} + 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 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 00000000..b1798060 --- /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 -- GitLab From a67b9a9d731fd096c19d30b3ab9aa8c8739c7723 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 28 Oct 2025 13:06:25 +0100 Subject: [PATCH 3/4] feat: implement test for redirect --- .../PartialAttributeUpdate/D005_01_red.robot | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot new file mode 100644 index 00000000..9b9b0b92 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot @@ -0,0 +1,75 @@ +*** Settings *** +Documentation Check that, given a redirect registration, partially updating an entity updates the Context Source accordingly. + +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_payload_filename} vehicle-simple-different-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-01-fragment.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${attribute_id} speed + +*** Test Cases *** +D005_01_red Partial Partial Attribute Update + [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches a redirect registration, the entity is updated on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 + Set Stub Reply PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 + ${response}= Partial Update Entity Attributes + ... ${entity_id} + ... ${attribute_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Wait For Request + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} + Should Be True ${stub_count} > 0 + ${stub_count}= Get Stub Count PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Setup Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${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=redirect + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + 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} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=redirect + ... endpoint=/broker2 + ${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 Context Source Registration ${registration_id2} + Delete Entity by Id ${entity_id} + Stop Context Source Mock Server -- GitLab From eb19e6d3c9d52830dca6f917671c44e91c03a67a Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 30 Oct 2025 15:26:24 +0100 Subject: [PATCH 4/4] fix: correct clause numbers in Tags --- .../EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot | 2 +- .../EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot | 2 +- .../EntityAttributes/PartialAttributeUpdate/D005_01_red.robot | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot index 254ed3cf..1254c60f 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot @@ -23,7 +23,7 @@ ${attribute_id} speed *** Test Cases *** D005_01_exc Partial Partial Attribute Update [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches an exclusive registration, this is updated on the Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_6_2 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_4 Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 ${response}= Partial Update Entity Attributes diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot index f5d4b252..72a2f1c8 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_inc.robot @@ -23,7 +23,7 @@ ${attribute_id} speed *** Test Cases *** D005_01_inc Partial Partial Attribute Update [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches an inclusive registration, this is updated on the Context Source too - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_4 Set Stub Reply PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 ${response}= Partial Update Entity Attributes diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot index 9b9b0b92..c709d9f2 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_red.robot @@ -23,7 +23,7 @@ ${attribute_id} speed *** Test Cases *** D005_01_red Partial Partial Attribute Update [Documentation] Check that if one request the Context Broker to partially update an attribute whose id matches a redirect registration, the entity is updated on the Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_4 Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 Set Stub Reply PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/${attribute_id} 204 -- GitLab