From f29655be3f2e1aa15697d3ab93926a27ed6f863a Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 14 Oct 2025 17:21:03 +0200 Subject: [PATCH 01/21] feat: append attribute test for inclusive --- .../AppendEntityAttributes/D003_01_inc.robot | 66 +++++++++++++++++++ ...hicle-speed-two-datasetid-01-fragment.json | 10 +++ 2 files changed, 76 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot create mode 100644 data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot new file mode 100644 index 00000000..2848ad29 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that, given an inclusive registration, appending entity attributes 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-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-01-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${expected_attribute} speed + +*** Test Cases *** +D003_01_inc Append Entity Attribute + [Documentation] Check that if one request the Context Broker to append 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 POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 207 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... Overwrite + Wait for redirected request + Check Response Status Code 207 ${response.status_code} + + ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + + ${response}= Retrieve Entity by Id ${entity_id} + Check Response Status Code 200 ${response.status_code} + Should Have Value In Json ${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} + 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} + ${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/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json new file mode 100644 index 00000000..fc7e3200 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json @@ -0,0 +1,10 @@ +{ + "speed": { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + } + } +} \ No newline at end of file -- GitLab From 15b5e68e8e3873a7296ecbe697a6571db1c172c7 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 14 Oct 2025 17:56:38 +0200 Subject: [PATCH 02/21] fix: update fragment filename --- .../AppendEntityAttributes/D003_01_inc.robot | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 2848ad29..12068cb4 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-01-fragment.json +${fragment_filename} vehicle-brandname-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld ${expected_attribute} speed @@ -31,7 +31,6 @@ D003_01_inc Append Entity Attribute ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} ... Overwrite - Wait for redirected request Check Response Status Code 207 ${response.status_code} ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ @@ -39,7 +38,7 @@ D003_01_inc Append Entity Attribute ${response}= Retrieve Entity by Id ${entity_id} Check Response Status Code 200 ${response.status_code} - Should Have Value In Json ${response.json()} $.speed + Should Have Value In Json ${response.json()} $.brandName *** Keywords *** -- GitLab From 03b866d2a2b6b826575657313574a1c7760f388f Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 10:37:17 +0200 Subject: [PATCH 03/21] fix: correct expected response status code --- .../AppendEntityAttributes/D003_01_inc.robot | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 12068cb4..eabe9ec1 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -18,20 +18,19 @@ Test Teardown Delete Registration And Stop Context Source Mock Server ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-brandname-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld -${expected_attribute} speed *** Test Cases *** D003_01_inc Append Entity Attribute [Documentation] Check that if one request the Context Broker to append 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 POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 207 + Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Append Entity Attributes With Parameters ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} ... Overwrite - Check Response Status Code 207 ${response.status_code} + Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ Should Be True ${stub_count} > 0 -- GitLab From c535873edf9f17dfc2ad41b42a4ff10e7f387c25 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 10:40:25 +0200 Subject: [PATCH 04/21] fix: remove check status code for retrieve entity by id --- .../EntityAttributes/AppendEntityAttributes/D003_01_inc.robot | 1 - 1 file changed, 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index eabe9ec1..03d822b0 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -36,7 +36,6 @@ D003_01_inc Append Entity Attribute Should Be True ${stub_count} > 0 ${response}= Retrieve Entity by Id ${entity_id} - Check Response Status Code 200 ${response.status_code} Should Have Value In Json ${response.json()} $.brandName -- GitLab From 8843abcdc1722765d8a13c49160223090113197e Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 11:39:59 +0200 Subject: [PATCH 05/21] fix: correct test logic --- .../AppendEntityAttributes/D003_01_inc.robot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 03d822b0..608fda89 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-brandname-fragment.json +${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** @@ -36,8 +36,8 @@ D003_01_inc Append Entity Attribute Should Be True ${stub_count} > 0 ${response}= Retrieve Entity by Id ${entity_id} - Should Have Value In Json ${response.json()} $.brandName - + Should Have Value In Json ${response.json()} $.isParked + Should Have Value In Json ${response.json()} $.speed *** Keywords *** Create Entity And Setup Registration And Start Context Source Mock Server -- GitLab From 435056f1ea9f9e44444cf57eaa565cb04ab2e757 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 11:52:19 +0200 Subject: [PATCH 06/21] feat: append attribute test for exclusive --- .../AppendEntityAttributes/D003_01_exc.robot | 61 +++++++++++++++++++ ...t-source-registration-vehicle-speed.jsonld | 21 +++++++ ...hicle-speed-two-datasetid-02-fragment.json | 19 ++++++ 3 files changed, 101 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld create mode 100644 data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json 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 new file mode 100644 index 00000000..a9e97f6a --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_exc.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Check that if one request the Context Broker to append an attribute whose id matches an exclusive registration, the entity is updated on the Context Broker and the update is forwarded to 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 Setup Registration 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-two-datasetid-02-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.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 additive-inclusive 4_3_6_2 5_6_2 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... Overwrite + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + 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 \ 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 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 diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json new file mode 100644 index 00000000..3ed3d200 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json @@ -0,0 +1,19 @@ +{ + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + } + }, + "speed": { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + } + } +} \ No newline at end of file -- GitLab From 34ddb779ab11b108f9ccd3e702ed845f314a1ff3 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 12:43:03 +0200 Subject: [PATCH 07/21] fix: add local value --- .../EntityAttributes/AppendEntityAttributes/D003_01_exc.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a9e97f6a..c93da675 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 @@ -40,7 +40,7 @@ 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} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id -- GitLab From 5a50a3517f60c8e9982de08698339c1bb08a896a Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 14:29:49 +0200 Subject: [PATCH 08/21] feat: append attribute test for redirect --- .../AppendEntityAttributes/D003_01_red.robot | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot new file mode 100644 index 00000000..0fb41339 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation Check that if one request the Context Broker to append an attribute whose id matches a redirect registration, the entity is updated on the Context Broker and the update is forwarded to 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 Setup Registration 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-two-datasetid-02-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D003_01_red 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 additive-inclusive 4_3_6_2 5_6_2 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... Overwrite + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ + 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 + ${response}= Create Entity ${entity_payload_filename} ${entity_id} + Check Response Status Code 201 ${response.status_code} + +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 \ No newline at end of file -- GitLab From 1773ae77bdff9fd044638154ab6c4c30648c6855 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 16:45:35 +0200 Subject: [PATCH 09/21] fix: upgrade test logic --- .../AppendEntityAttributes/D003_01_inc.robot | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 608fda89..d2124fca 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -24,6 +24,9 @@ D003_01_inc Append Entity Attribute [Documentation] Check that if one request the Context Broker to append 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 + ${response}= Retrieve Entity by Id ${entity_id} + ${old_body}= Get From Dictionary ${response.json()} isParked default=${None} + Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Append Entity Attributes With Parameters ... ${entity_id} @@ -36,8 +39,10 @@ D003_01_inc Append Entity Attribute Should Be True ${stub_count} > 0 ${response}= Retrieve Entity by Id ${entity_id} - Should Have Value In Json ${response.json()} $.isParked + ${new_body}= Get From Dictionary ${response.json()} isParked default=${None} + Should Have Value In Json ${response.json()} $.speed + Should Not Be Equal ${old_body} ${new_body} *** Keywords *** Create Entity And Setup Registration And Start Context Source Mock Server -- GitLab From d035d329a393badce56e2bd19f7ea90079207304 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 16:47:19 +0200 Subject: [PATCH 10/21] feat: append attribute test for inclusive with noOverwrite --- .../AppendEntityAttributes/D003_02_inc.robot | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot new file mode 100644 index 00000000..f692154b --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that, given an inclusive registration with the noOverwrite flag, appending entity attributes updates the Context Source accordingly but does not modify existing attributes. + +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-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D003_02_inc Append Entity Attribute + [Documentation] Check that if one request the Context Broker to append 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 + + ${response}= Retrieve Entity by Id ${entity_id} + ${old_body}= Get From Dictionary ${response.json()} isParked default=${None} + + Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... noOverwrite + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + + ${response}= Retrieve Entity by Id ${entity_id} + ${new_body}= Get From Dictionary ${response.json()} isParked default=${None} + + Should Have Value In Json ${response.json()} $.speed + Should Be Equal ${old_body} ${new_body} + +*** 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} + ${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 9a2752a1f90f3415ef9edb381a4992df54041dc9 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 16 Oct 2025 17:43:50 +0200 Subject: [PATCH 11/21] fix: remove typos --- .../EntityAttributes/AppendEntityAttributes/D003_01_exc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_01_red.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_02_inc.robot | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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 c93da675..d7956fe6 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 @@ -22,7 +22,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** 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 additive-inclusive 4_3_6_2 5_6_2 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_6_2 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Append Entity Attributes With Parameters diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index 0fb41339..26b2e805 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -22,7 +22,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_01_red 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 additive-inclusive 4_3_6_2 5_6_2 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot index f692154b..0f653a4b 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -25,7 +25,7 @@ D003_02_inc Append Entity Attribute [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 ${response}= Retrieve Entity by Id ${entity_id} - ${old_body}= Get From Dictionary ${response.json()} isParked default=${None} + ${old_body}= Get From Dictionary ${response.json()} isParked Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Append Entity Attributes With Parameters @@ -39,7 +39,7 @@ D003_02_inc Append Entity Attribute Should Be True ${stub_count} > 0 ${response}= Retrieve Entity by Id ${entity_id} - ${new_body}= Get From Dictionary ${response.json()} isParked default=${None} + ${new_body}= Get From Dictionary ${response.json()} isParked Should Have Value In Json ${response.json()} $.speed Should Be Equal ${old_body} ${new_body} -- GitLab From c5b7ccba5075b03f415a1a7678acfaf0a8385525 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 21 Oct 2025 16:11:47 +0200 Subject: [PATCH 12/21] fix: minor changes to the code --- .../EntityAttributes/AppendEntityAttributes/D003_01_inc.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index d2124fca..636f80c5 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -25,7 +25,7 @@ D003_01_inc Append Entity Attribute [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 ${response}= Retrieve Entity by Id ${entity_id} - ${old_body}= Get From Dictionary ${response.json()} isParked default=${None} + ${old_body}= Get From Dictionary ${response.json()} isParked Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Append Entity Attributes With Parameters @@ -39,7 +39,7 @@ D003_01_inc Append Entity Attribute Should Be True ${stub_count} > 0 ${response}= Retrieve Entity by Id ${entity_id} - ${new_body}= Get From Dictionary ${response.json()} isParked default=${None} + ${new_body}= Get From Dictionary ${response.json()} isParked Should Have Value In Json ${response.json()} $.speed Should Not Be Equal ${old_body} ${new_body} -- GitLab From ce3744b64b1d15997748689b706c5815ed65a65f Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 21 Oct 2025 17:25:58 +0200 Subject: [PATCH 13/21] fix: change registration file to be correct --- .../EntityAttributes/AppendEntityAttributes/D003_01_inc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_01_red.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 636f80c5..61447f5c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D003_01_inc Append Entity Attribute diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index 26b2e805..07074537 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -17,7 +17,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D003_01_red Append Entity Attribute -- GitLab From c9d13a24c209819b5978ce883d672e0e9704df92 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 21 Oct 2025 17:30:22 +0200 Subject: [PATCH 14/21] feat: add new tests for the noOverwrite operation --- .../AppendEntityAttributes/D003_02_exc.robot | 63 ++++++++++++++++ .../AppendEntityAttributes/D003_02_inc.robot | 11 ++- .../AppendEntityAttributes/D003_02_red.robot | 75 +++++++++++++++++++ 3 files changed, 143 insertions(+), 6 deletions(-) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot new file mode 100644 index 00000000..2dbad12b --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration with noOverwrite flag, the entity is updated on the Context Broker and the update is forwarded to the Context Source but existing attributes are not overwritten + +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-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D003_02_exc Append Entity Attribute + [Documentation] Check that an entity attribute is appended and the exclusive registration forwards the request to the Context Source with the noOverwrite flag + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_6_2 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... noOverwrite + Wait for redirected request + Check Response Status Code 204 ${response.status_code} + + ${stub}= Get Stub POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Contain ${stub} noOverwrite + +*** 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/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot index 0f653a4b..d6a6f658 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that, given an inclusive registration with the noOverwrite flag, appending entity attributes updates the Context Source accordingly but does not modify existing attributes. +Documentation Check that, given an inclusive registration with the noOverwrite flag, appending entity attributes creates the new attributes in the Context Source accordingly but does not modify existing ones. Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -13,15 +13,14 @@ 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-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D003_02_inc Append Entity Attribute - [Documentation] Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, this is updated on the Context Source too + [Documentation] Check that an entity attribute is appended and the inclusive registration forwards the request to the Context Source with the noOverwrite flag [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 ${response}= Retrieve Entity by Id ${entity_id} @@ -35,8 +34,8 @@ D003_02_inc Append Entity Attribute ... noOverwrite Check Response Status Code 204 ${response.status_code} - ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ - Should Be True ${stub_count} > 0 + ${stub}= Get Stub POST /ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Contain ${stub} noOverwrite ${response}= Retrieve Entity by Id ${entity_id} ${new_body}= Get From Dictionary ${response.json()} isParked diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot new file mode 100644 index 00000000..c84368da --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot @@ -0,0 +1,75 @@ +*** Settings *** +Documentation Check that if one request the Context Broker to append an attribute whose id matches a redirect registration with noOverwrite flag, the entity is updated on the Context Broker and the update is forwarded to the Context Source but existing attributes are not overwritten + +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-attributes.jsonld +${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + +*** Test Cases *** +D003_02_red Append Entity Attribute + [Documentation] Check that an entity attribute is appended and the redirect registration forwards the request to the Context Source with the noOverwrite flag + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... noOverwrite + Wait for redirected request + Check Response Status Code 204 ${response.status_code} + + ${stub}= Get Stub POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Contain ${stub} noOverwrite + ${stub}= Get Stub POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Contain ${stub} noOverwrite + +*** 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 \ No newline at end of file -- GitLab From 2307a4655f2843bf035f56b8bdf03d32a7afc0b6 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 23 Oct 2025 14:33:59 +0200 Subject: [PATCH 15/21] fix: issue with noOverwrite option --- .../AppendEntityAttributes/D003_02_exc.robot | 6 +++--- .../AppendEntityAttributes/D003_02_inc.robot | 11 ++++++----- .../AppendEntityAttributes/D003_02_red.robot | 12 +++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot index 2dbad12b..aa489972 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot @@ -24,16 +24,16 @@ D003_02_exc Append Entity Attribute [Documentation] Check that an entity attribute is appended and the exclusive registration forwards the request to the Context Source with the noOverwrite flag [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_2 5_6_2 - Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 ${response}= Append Entity Attributes With Parameters ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} ... noOverwrite Wait for redirected request - Check Response Status Code 204 ${response.status_code} + Check Response Status Code 207 ${response.status_code} - ${stub}= Get Stub POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + ${stub}= Get Request Url Params options Should Contain ${stub} noOverwrite *** Keywords *** diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot index d6a6f658..b760dcd2 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_02_inc Append Entity Attribute @@ -26,20 +26,20 @@ D003_02_inc Append Entity Attribute ${response}= Retrieve Entity by Id ${entity_id} ${old_body}= Get From Dictionary ${response.json()} isParked - Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 207 ${response}= Append Entity Attributes With Parameters ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} ... noOverwrite - Check Response Status Code 204 ${response.status_code} + Wait For Request + Check Response Status Code 207 ${response.status_code} - ${stub}= Get Stub POST /ngsi-ld/v1/entities/${entity_id}/attrs/ + ${stub}= Get Request Url Params options Should Contain ${stub} noOverwrite ${response}= Retrieve Entity by Id ${entity_id} ${new_body}= Get From Dictionary ${response.json()} isParked - Should Have Value In Json ${response.json()} $.speed Should Be Equal ${old_body} ${new_body} @@ -57,6 +57,7 @@ Create Entity And Setup Registration And Start Context Source Mock Server ... ${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 diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot index c84368da..9a2c7a72 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot @@ -17,26 +17,24 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_02_red Append Entity Attribute [Documentation] Check that an entity attribute is appended and the redirect registration forwards the request to the Context Source with the noOverwrite flag [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 - Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 - Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 + Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 ${response}= Append Entity Attributes With Parameters ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} ... noOverwrite Wait for redirected request - Check Response Status Code 204 ${response.status_code} + Check Response Status Code 207 ${response.status_code} - ${stub}= Get Stub POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ - Should Contain ${stub} noOverwrite - ${stub}= Get Stub POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ + ${stub}= Get Request Url Params options Should Contain ${stub} noOverwrite *** Keywords *** -- GitLab From 8d4336a912ea85d9ecc45d660c1bc5f42e72fa64 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 23 Oct 2025 14:50:32 +0200 Subject: [PATCH 16/21] fix: remove unused file --- .../vehicle-speed-two-datasetid-01-fragment.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json deleted file mode 100644 index fc7e3200..00000000 --- a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "speed": { - "type": "Property", - "value": 99, - "source": { - "type": "Property", - "value": "Speedometer" - } - } -} \ No newline at end of file -- GitLab From d7fcf501d53ac45e68cc839e1498bec284050c4d Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 23 Oct 2025 14:55:44 +0200 Subject: [PATCH 17/21] feat: add new function Get Request Url Params --- .../src/HttpCtrl/__init__.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/libraries/robotframework-httpctrl/src/HttpCtrl/__init__.py b/libraries/robotframework-httpctrl/src/HttpCtrl/__init__.py index 57198481..d37c89de 100755 --- a/libraries/robotframework-httpctrl/src/HttpCtrl/__init__.py +++ b/libraries/robotframework-httpctrl/src/HttpCtrl/__init__.py @@ -13,6 +13,8 @@ import http.client import json import threading +from urllib.parse import urlparse, parse_qs + from robot.api import logger from HttpCtrl.utils.logger import LoggerAssistant @@ -1119,6 +1121,43 @@ class Server: response = Response(int(status), None, json.dumps(body), None, None) HttpStubContainer().add(criteria, response) + def get_stub(self, method, url): + """ + + Returns server stub that is used by server to reply. + + `method` [in] (string): Request method that is used to handle by server stub (GET, POST, DELETE, etc., see: RFC 7231, RFC 5789). + + `url` [in] (string): Path to the resource that is used by server stub, for example, in case address www.httpbin.org/ip - '/ip' is an path. + + Example how to get server stub for request with `POST` method and URL `/api/v2/request`. + + +----------------+------+-----------------+ + | Get Stub | POST | /api/v2/request | + +----------------+------+-----------------+ + + .. code:: text + + Get Stub POST /api/v2/request + + Example how to get server stub for request with `GET` method and URL `/get` + + +----------------+------+-----+ + | Get Stub | GET | /get | + +----------------+------+-----+ + + .. code:: text + + Get Stub GET /get + + """ + if self.__server is None: + message_error = "Impossible to get server stub (reason: 'server is not created')." + raise AssertionError(message_error) + + criteria = HttpStubCriteria(method=method, url=url) + result = HttpStubContainer().get(criteria, None) + return result def get_stub_count(self, method, url): """ @@ -1296,6 +1335,30 @@ class Server: """ return self.__request.get_url() + + def get_request_url_params(self, param_name): + """ + + Returns URL parameters of received request as a dictionary. This function should be called after \`Wait For Request\`, + otherwise None is returned. + + Example how to obtain URL parameters of incoming request: + + +-----------------------+ + | Get Request Url Params | + +-----------------------+ + + .. code:: text + + Get Request Url Params + + """ + url = self.__request.get_url() + parsed_url = urlparse(url) + params = parse_qs(parsed_url.query) + + param_value = params[param_name] + return param_value[0] if len(param_value) == 1 else param_value def set_reply_header(self, key, value): -- GitLab From b004df1351550bbdecd9ffe0d54c870024fae0ea Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 23 Oct 2025 16:28:08 +0200 Subject: [PATCH 18/21] fix: mistake in file name --- .../EntityAttributes/AppendEntityAttributes/D003_01_inc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_01_red.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 61447f5c..636f80c5 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_01_inc Append Entity Attribute diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index 07074537..26b2e805 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -17,7 +17,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld ${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_01_red Append Entity Attribute -- GitLab From 87f5895dc552b07502ed7b07ecb164a7191194a8 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 30 Oct 2025 13:35:24 +0100 Subject: [PATCH 19/21] fix: review changes apply --- .../AppendEntityAttributes/D003_01_exc.robot | 20 ++++++++++--------- .../AppendEntityAttributes/D003_01_inc.robot | 9 ++++----- .../AppendEntityAttributes/D003_01_red.robot | 19 +++++++++--------- .../AppendEntityAttributes/D003_02_exc.robot | 4 ++-- .../AppendEntityAttributes/D003_02_inc.robot | 2 +- .../AppendEntityAttributes/D003_02_red.robot | 2 +- ...n => vehicle-speed-isParked-fragment.json} | 0 7 files changed, 28 insertions(+), 28 deletions(-) rename data/entities/fragmentEntities/{vehicle-speed-two-datasetid-02-fragment.json => vehicle-speed-isParked-fragment.json} (100%) 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 d7956fe6..65c10b86 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 @@ -1,14 +1,13 @@ *** Settings *** -Documentation Check that if one request the Context Broker to append an attribute whose id matches an exclusive registration, the entity is updated on the Context Broker and the update is forwarded to the Context Source +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/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 +Resource ../../../../../../resources/ApiUtils/ContextInformationConsumption.resource Test Setup Create Entity And Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server @@ -16,31 +15,34 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.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_2 5_6_2 + [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 With Parameters + ${response}= Append Entity Attributes ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} - ... Overwrite Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ - 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 + Should Not Contain ${body} 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} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=true Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 636f80c5..ea749a11 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -16,27 +16,26 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_01_inc Append Entity Attribute - [Documentation] Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, this is updated on the Context Source too + [Documentation] Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, the update is performed on the Context Broker and forwarded to the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 ${response}= Retrieve Entity by Id ${entity_id} ${old_body}= Get From Dictionary ${response.json()} isParked Set Stub Reply POST /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 - ${response}= Append Entity Attributes With Parameters + ${response}= Append Entity Attributes ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} - ... Overwrite Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count POST /ngsi-ld/v1/entities/${entity_id}/attrs/ - Should Be True ${stub_count} > 0 + Should Be Equal ${stub_count} 1 ${response}= Retrieve Entity by Id ${entity_id} ${new_body}= Get From Dictionary ${response.json()} isParked diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index 26b2e805..fbc857ac 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -1,6 +1,5 @@ *** Settings *** -Documentation Check that if one request the Context Broker to append an attribute whose id matches a redirect registration, the entity is updated on the Context Broker and the update is forwarded to the Context Source - +Documentation Check that if one request the Context Broker to append an attribute whose id matches two redirect registrations, the update is forwarded and the entity attributes are updated in both Context Sources Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource @@ -16,27 +15,29 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** D003_01_red Append Entity Attribute - [Documentation] Check that an entity attribute is appended and the exclusive registration forwards the request to the Context Source + [Documentation] Check that an entity attribute is appended and the redirect registration forwards the request to the Context Sources [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_6_2 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 - ${response}= Append Entity Attributes With Parameters + ${response}= Append Entity Attributes ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_JSON} - ... Overwrite Check Response Status Code 204 ${response.status_code} ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ - Should Be True ${stub_count} > 0 + Should Be Equal ${stub_count} 1 ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ - 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 + Check Response Status Code 404 ${response.status_code} *** Keywords *** Create Entity And Setup Registration And Start Context Source Mock Server @@ -66,8 +67,6 @@ Create Entity And Setup Registration And Start Context Source Mock Server Check Response Status Code 201 ${response.status_code} Start Context Source Mock Server - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot index aa489972..eee9dd65 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration with noOverwrite flag, the entity is updated on the Context Broker and the update is forwarded to the Context Source but existing attributes are not overwritten +Documentation Check that if one request the Context Broker to append an attribute whose id matches an exclusive registration with noOverwrite flag, the entity is updated on the Context Broker and the update is forwarded to the Context Source but existing attributes are not overwritten Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -16,7 +16,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot index b760dcd2..b0806eb2 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -15,7 +15,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot index 9a2c7a72..85ba6578 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot @@ -16,7 +16,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_payload_filename} vehicle-simple-attributes.jsonld -${fragment_filename} vehicle-speed-two-datasetid-02-fragment.json +${fragment_filename} vehicle-speed-isParked-fragment.json ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json b/data/entities/fragmentEntities/vehicle-speed-isParked-fragment.json similarity index 100% rename from data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.json rename to data/entities/fragmentEntities/vehicle-speed-isParked-fragment.json -- GitLab From bd7a860982675fc0dc536f5ef68dfe75004f9980 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 30 Oct 2025 15:16:26 +0100 Subject: [PATCH 20/21] fix: correct clause numbers in Tags --- .../EntityAttributes/AppendEntityAttributes/D003_01_inc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_01_red.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_02_exc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_02_inc.robot | 2 +- .../EntityAttributes/AppendEntityAttributes/D003_02_red.robot | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index ea749a11..79ebcdda 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -22,7 +22,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_01_inc Append Entity Attribute [Documentation] Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, the update is performed on the Context Broker and forwarded to the Context Source - [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_3 ${response}= Retrieve Entity by Id ${entity_id} ${old_body}= Get From Dictionary ${response.json()} isParked diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index fbc857ac..4c330bc1 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -21,7 +21,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_01_red Append Entity Attribute [Documentation] Check that an entity attribute is appended and the redirect registration forwards the request to the Context Sources - [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_3 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot index eee9dd65..55ebba1c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_exc.robot @@ -22,7 +22,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_02_exc Append Entity Attribute [Documentation] Check that an entity attribute is appended and the exclusive registration forwards the request to the Context Source with the noOverwrite flag - [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_3 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 ${response}= Append Entity Attributes With Parameters diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot index b0806eb2..e7bbb65c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_inc.robot @@ -21,7 +21,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_02_inc Append Entity Attribute [Documentation] Check that an entity attribute is appended and the inclusive registration forwards the request to the Context Source with the noOverwrite flag - [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_3 ${response}= Retrieve Entity by Id ${entity_id} ${old_body}= Get From Dictionary ${response.json()} isParked diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot index 85ba6578..7592e9ea 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot @@ -22,7 +22,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_02_red Append Entity Attribute [Documentation] Check that an entity attribute is appended and the redirect registration forwards the request to the Context Source with the noOverwrite flag - [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_3 Set Stub Reply POST /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 Set Stub Reply POST /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 207 -- GitLab From 9f1c566c5ef1fe8fa93220f54c71fbbae8ccc747 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 30 Oct 2025 17:55:02 +0100 Subject: [PATCH 21/21] fix: apply more changes to the tests according to reviews --- .../AppendEntityAttributes/D003_01_exc.robot | 1 - .../AppendEntityAttributes/D003_01_inc.robot | 4 ++-- .../AppendEntityAttributes/D003_01_red.robot | 5 ++--- .../AppendEntityAttributes/D003_02_red.robot | 5 ++--- 4 files changed, 6 insertions(+), 9 deletions(-) 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 65c10b86..63907c11 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 @@ -7,7 +7,6 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.reso Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Resource ../../../../../../resources/ApiUtils/ContextInformationConsumption.resource Test Setup Create Entity And Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot index 79ebcdda..72579532 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that, given an inclusive registration, appending entity attributes updates the Context Source accordingly. +Documentation Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, the update is performed on the Context Broker and forwarded to the Context Source Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -21,7 +21,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D003_01_inc Append Entity Attribute - [Documentation] Check that if one request the Context Broker to append an attribute whose id matches an inclusive registration, the update is performed on the Context Broker and forwarded to the Context Source + [Documentation] Check that, given an inclusive registration, appending entity attributes updates the Context Source accordingly. [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_3 ${response}= Retrieve Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot index 4c330bc1..c25f2a38 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_01_red.robot @@ -9,7 +9,7 @@ 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 Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server @@ -40,7 +40,7 @@ D003_01_red Append Entity Attribute Check Response Status Code 404 ${response.status_code} *** Keywords *** -Create Entity And Setup Registration And Start Context Source Mock Server +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} @@ -71,5 +71,4 @@ Create Entity And Setup Registration And 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 \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot index 7592e9ea..42eb5fab 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/AppendEntityAttributes/D003_02_red.robot @@ -10,7 +10,7 @@ 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 Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server @@ -38,7 +38,7 @@ D003_02_red Append Entity Attribute Should Contain ${stub} noOverwrite *** Keywords *** -Create Entity And Setup Registration And Start Context Source Mock Server +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} @@ -69,5 +69,4 @@ Create Entity And Setup Registration And 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 \ No newline at end of file -- GitLab