From 7fd0dd0be0f41caa367c74913e31729af0071472 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 9 Oct 2025 17:16:11 +0200 Subject: [PATCH 1/5] feat: implement new updateEntity test for redirect --- .../UpdateEntityAttributes/D004_01_red.robot | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot new file mode 100644 index 00000000..58d8c0fc --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot @@ -0,0 +1,80 @@ +*** Settings *** +Documentation Verify that, when one has a redirect registration on a Context Broker with redirectionOps, one is able to update 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 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 +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${fragment_filename} vehicle-brandname-complete-fragment.jsonld + +*** Test Cases *** +D004_01_red Query The Context Broker With Type + [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too + [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 201 + Set Stub Reply POST /broker2/ngsi-ld/v1/entities 201 + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} + Check Response Status Code 201 ${response.status_code} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} + Check Response Status Code 201 ${response.status_code} + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + ${stub_count}= Get Stub Count PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + +*** Keywords *** +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 + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.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 + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Context Source Registration ${registration_id2} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 09a6a49debec6cbfbb81071fc78717c88ca03a2b Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 9 Oct 2025 18:04:54 +0200 Subject: [PATCH 2/5] feat: implement test for updateEntity for exclusive --- .../UpdateEntityAttributes/D004_01_exc.robot | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot new file mode 100644 index 00000000..77479438 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Verify that an entity with an exclusive attribute is registered on the Context Source and said attribute can be updated via the Context Broker with redirectionOps + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.jsonld +${entity_newSpeed_filename} vehicle-speed-different-attribute.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D004_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is updated correctly in the Context Source via redirectionOps + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${entity_newSpeed_filename} + ... ${CONTENT_TYPE_LD_JSON} + ${response}= Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity 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} 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 \ No newline at end of file -- GitLab From fef084c8713073de2f13f881a64ba9fde0864426 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 14 Oct 2025 11:52:35 +0200 Subject: [PATCH 3/5] add: implement updateEntity test for redirect --- .../UpdateEntityAttributes/D004_01_red.robot | 8 -------- 1 file changed, 8 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot index 58d8c0fc..ff8e34dd 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot @@ -24,14 +24,6 @@ D004_01_red Query The Context Broker With Type [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too [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 201 - Set Stub Reply POST /broker2/ngsi-ld/v1/entities 201 - - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} - Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 Set Stub Reply PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 -- GitLab From acae6a4b2ce2c9c591028944d35a8847f26a2b7b Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 14 Oct 2025 11:57:14 +0200 Subject: [PATCH 4/5] add: missing test files --- ...t-source-registration-vehicle-speed.jsonld | 21 +++++++++++++++++++ .../vehicle-speed-different-attribute.jsonld | 15 +++++++++++++ data/entities/vehicle-speed-attribute.jsonld | 15 +++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld create mode 100644 data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld create mode 100644 data/entities/vehicle-speed-attribute.jsonld 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-different-attribute.jsonld b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld new file mode 100644 index 00000000..dc6f3b80 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 66, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/vehicle-speed-attribute.jsonld b/data/entities/vehicle-speed-attribute.jsonld new file mode 100644 index 00000000..74623080 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file -- GitLab From 10665dd22318c395775d417229b83443cca1c742 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 30 Oct 2025 15:33:26 +0100 Subject: [PATCH 5/5] fix: correct clause number in Tags --- .../EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot | 2 +- .../EntityAttributes/UpdateEntityAttributes/D004_01_red.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot index 77479438..c9db6eac 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot @@ -24,7 +24,7 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D004_01_exc Create Entity and Registration And Start Context Source Mock Server [Documentation] Check that the entity is updated correctly in the Context Source via redirectionOps - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_2 Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Update Entity Attributes diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot index ff8e34dd..271bc916 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_red.robot @@ -22,7 +22,7 @@ ${fragment_filename} vehicle-brandname-complete-fragment.json *** Test Cases *** D004_01_red Query The Context Broker With Type [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too - [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_2 Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 Set Stub Reply PATCH /broker2/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 -- GitLab