From 1dc1eb8f2fcf5c6f9bfb2fd7a57c6b57bd778470 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 3 Nov 2025 17:42:35 +0100 Subject: [PATCH 1/9] feat: add new test for inclusive --- .../Entities/ReplaceEntity/D007_01_inc.robot | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot new file mode 100644 index 00000000..f60baf48 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to create entities on both Context Broker and Context Source + +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 Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_payload_filename} vehicle-simple-attributes.json +${entity_replacement} vehicle-simple-attributes-second.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + + +*** Test Cases *** +D007_01_inc Replace Entity + [Documentation] Check that if one requests the Context Broker to replace an entity that matches an inclusive registration, this is replaced 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_18 + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + ${old_body}= Set To Dictionary ${response.json()} + + Set Stub Reply PUT /ngsi-ld/v1/entities/${entity_id} 204 + ${response}= Replace Entity + ... entity_id=${entity_id} + ... filename=${entity_replacement} + ... content_type=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + ${new_body}= Set To Dictionary ${response.json()} + Should Not Be Equal ${old_body} ${new_body} + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity Selecting Content Type + ... ${entity_payload_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + 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 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 -- GitLab From 455772424020d54b5421b220a27cc6fd2cb05a5b Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 3 Nov 2025 17:45:04 +0100 Subject: [PATCH 2/9] fix: update documentation to reflect entity replacement --- .../Provision/Entities/ReplaceEntity/D007_01_inc.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot index f60baf48..5f12ef1f 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to create entities on both Context Broker and Context Source +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to replace an entity on both Context Broker and Context Source Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource -- GitLab From 695be9289ea9584970076b9445b432f27447a49e Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 6 Nov 2025 16:00:01 +0100 Subject: [PATCH 3/9] feat: implement new test for exclusive --- .../Entities/ReplaceEntity/D007_01_exc.robot | 66 +++++++++++++++++++ ...-vehicle-speed-with-redirection-ops.jsonld | 1 + .../vehicle-simple-different-attributes.json | 22 +++++++ .../Provision/D007_01_exc.json | 43 ++++++++++++ .../Provision/D007_01_inc.json | 43 ++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot create mode 100644 data/entities/vehicle-simple-different-attributes.json create mode 100644 doc/files/DistributedOperations/Provision/D007_01_exc.json create mode 100644 doc/files/DistributedOperations/Provision/D007_01_inc.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot new file mode 100644 index 00000000..5ec570a2 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker, one is able to replace the entity on the Context Source + +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 Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_replacement} vehicle-simple-different-attributes.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D007_01_exc Replace Entity + [Documentation] Check that if one requests the Context Broker to replace an entity that matches an exclusive registration, the entity is replaced on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_18 + + Set Stub Reply PUT /broker1/ngsi-ld/v1/entities/${entity_id} 204 + ${response}= Replace Entity + ... entity_id=${entity_id} + ... filename=${entity_replacement} + ... content_type=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PUT /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} local=true + ${body}= Get From Dictionary ${response.json()} speed + Should Not Contain ${body} speed + +*** Keywords *** +Create Entity And Registration On The Context Broker 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 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 diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld index b1798060..6d1bf0c0 100644 --- a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld @@ -1,3 +1,4 @@ + { "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", "type": "ContextSourceRegistration", diff --git a/data/entities/vehicle-simple-different-attributes.json b/data/entities/vehicle-simple-different-attributes.json new file mode 100644 index 00000000..63005769 --- /dev/null +++ b/data/entities/vehicle-simple-different-attributes.json @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed2" + }, + "isParked2": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown2", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Alice" + } + } +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D007_01_exc.json b/doc/files/DistributedOperations/Provision/D007_01_exc.json new file mode 100644 index 00000000..862fc36c --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D007_01_exc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_exc", + "test_objective": "Verify that, when one has an exclusive registration on a Context Broker, one is able to replace the entity on the Context Source", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.18", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.18" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D007_01_exc Replace Entity", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_exc", + "doc": "Check that if one requests the Context Broker to replace an entity that matches an exclusive registration, the entity is replaced on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_18", + "cf_06", + "dist-ops", + "proxy-exclusive", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/Entities/ReplaceEntity", + "robotfile": "D007_01_exc" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D007_01_inc.json b/doc/files/DistributedOperations/Provision/D007_01_inc.json new file mode 100644 index 00000000..a9163dc7 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D007_01_inc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_inc", + "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to replace an entity on both Context Broker and Context Source", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.18", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.18" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D007_01_inc Replace Entity", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_inc", + "doc": "Check that if one requests the Context Broker to replace an entity that matches an inclusive registration, this is replaced on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_18", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/Entities/ReplaceEntity", + "robotfile": "D007_01_inc" +} \ No newline at end of file -- GitLab From f8fc31699ab40d54c7876a07208be1b6101b66a3 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 6 Nov 2025 16:00:45 +0100 Subject: [PATCH 4/9] feat: implement new test for redirect --- .../Entities/ReplaceEntity/D007_01_red.robot | 78 +++++++++++++++++++ .../Provision/D007_01_red.json | 43 ++++++++++ 2 files changed, 121 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot create mode 100644 doc/files/DistributedOperations/Provision/D007_01_red.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot new file mode 100644 index 00000000..4fa61dac --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot @@ -0,0 +1,78 @@ +*** Settings *** +Documentation Verify that, when one has a redirect registration on a Context Broker, one is able to replace the entities on the Context Sources + +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 Setup Entity Id And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_replacement} vehicle-simple-attributes-second.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D007_01_red Replace Entity + [Documentation] Check that if one requests the Context Broker to replace an entity that matches redirect registrations, the entity is replaced on the Context Sources + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_18 + + Set Stub Reply PUT /broker1/ngsi-ld/v1/entities/${entity_id} 204 + Set Stub Reply PUT /broker2/ngsi-ld/v1/entities/${entity_id} 204 + + ${response}= Replace Entity + ... entity_id=${entity_id} + ... filename=${entity_replacement} + ... content_type=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PUT /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + ${stub_count}= Get Stub Count PUT /broker2/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + +*** Keywords *** +Setup Entity Id And 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=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 Created Entity And 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 diff --git a/doc/files/DistributedOperations/Provision/D007_01_red.json b/doc/files/DistributedOperations/Provision/D007_01_red.json new file mode 100644 index 00000000..96494ba0 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D007_01_red.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_red", + "test_objective": "Verify that, when one has a redirect registration on a Context Broker, one is able to replace the entities on the Context Sources", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.18", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.18" + ], + "pics_selection": "", + "keywords": [ + "Setup Entity Id And Registration And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity id set to ${entity_id}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D007_01_red Replace Entity", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D007_01_red", + "doc": "Check that if one requests the Context Broker to replace an entity that matches redirect registrations, the entity is replaced on the Context Sources", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_18", + "cf_06", + "dist-ops", + "proxy-redirect", + "since_v1.6.1" + ], + "setup": "Setup Entity Id And Registration And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "PUT", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/Entities/ReplaceEntity", + "robotfile": "D007_01_red" +} \ No newline at end of file -- GitLab From 35ab443f59ad7cddf41c4167f7b4ff95997042b8 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 6 Nov 2025 16:08:30 +0100 Subject: [PATCH 5/9] fix: correct file name --- .../Provision/Entities/ReplaceEntity/D007_01_red.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot index 4fa61dac..277b5d71 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${entity_replacement} vehicle-simple-attributes-second.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D007_01_red Replace Entity -- GitLab From e9e7721eb461c0da2b0a8d454825995ad53daf1b Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 10 Nov 2025 14:55:08 +0100 Subject: [PATCH 6/9] fix: resolve conflict in file --- ...ource-registration-vehicle-speed-with-redirection-ops.jsonld | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld index 6d1bf0c0..19d84356 100644 --- a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld @@ -1,4 +1,3 @@ - { "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", "type": "ContextSourceRegistration", @@ -9,7 +8,6 @@ "id": "urn:ngsi-ld:Vehicle:randomUUID", "type": "Vehicle" } - ], "propertyNames":["speed"] } -- GitLab From 0c6a644f2fac4d03251ad959464fab1b17d175cf Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 6 Nov 2025 16:00:01 +0100 Subject: [PATCH 7/9] feat: implement new test for exclusive --- ...source-registration-vehicle-speed-with-redirection-ops.jsonld | 1 + 1 file changed, 1 insertion(+) diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld index 19d84356..643ffd4c 100644 --- a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld @@ -1,3 +1,4 @@ + { "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", "type": "ContextSourceRegistration", -- GitLab From b8178e01fb8ac5ec621283b0810463716904e73a Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 18 Nov 2025 10:54:53 +0100 Subject: [PATCH 8/9] fix: apply changes based on review --- .../Provision/Entities/ReplaceEntity/D007_01_exc.robot | 2 +- .../Provision/Entities/ReplaceEntity/D007_01_red.robot | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot index 5ec570a2..b3bc342d 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_exc.robot @@ -33,7 +33,7 @@ D007_01_exc Replace Entity Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count PUT /broker1/ngsi-ld/v1/entities/${entity_id} - Should Be True ${stub_count} > 0 + Should Be Equal ${stub_count} 1 ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} local=true ${body}= Get From Dictionary ${response.json()} speed diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot index 277b5d71..2dbf53de 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/ReplaceEntity/D007_01_red.robot @@ -35,18 +35,15 @@ D007_01_red Replace Entity Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count PUT /broker1/ngsi-ld/v1/entities/${entity_id} - Should Be True ${stub_count} > 0 + Should Be Equal ${stub_count} 1 ${stub_count}= Get Stub Count PUT /broker2/ngsi-ld/v1/entities/${entity_id} - Should Be True ${stub_count} > 0 + Should Be Equal ${stub_count} 1 *** Keywords *** Setup Entity Id And 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 @@ -74,5 +71,4 @@ Setup Entity Id And Registration And Start Context Source Mock Server Delete Created Entity And 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 71b7109a4b3c816e5f76a968dbc4f7faa3bc592c Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 3 Nov 2025 15:22:39 +0000 Subject: [PATCH 9/9] Resolve "Add TCs for Append Entity Attributes in the Distributed Case" --- .../AppendEntityAttributes/D003_01_exc.robot | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot index c6ece0be..6967513b 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot @@ -12,6 +12,68 @@ Test Setup Create Entity And Registration On The Context Broker And Sta Test Teardown Delete Registration And Stop Context Source Mock Server +*** Variables *** +${entity_payload_filename} vehicle-simple-attributes.jsonld +${fragment_filename} vehicle-speed-isParked-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D003_01_exc Append Entity Attribute + [Documentation] Check that an entity attribute is appended and the exclusive registration forwards the request to the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_3 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be Equal ${stub_count} 1 + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} local=true + ${body}= Get From Dictionary ${response.json()} speed + Should Not Contain ${body} speed + +*** Keywords *** +Create Entity And Registration On The Context Broker 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 +*** Settings *** +Documentation Check that when appending entity attributes to an entity with an exclusive registration, the attributes managed locally are updated on the Context Broker, while attributes managed with the exclusive registration are updated in the Context Source. + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.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 Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + + *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-isParked-fragment.json -- GitLab