From 006a4144055bb7c058e473aca8071d47edc21299 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 4 Dec 2025 16:24:49 +0100 Subject: [PATCH 01/10] feat: new test for inclusive no replace flag --- .../BatchEntitiesUpsert/D013_01_inc.robot | 69 +++++++++++++++++++ .../Provision/D013_01_inc.json | 43 ++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_01_inc.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot new file mode 100644 index 00000000..0c75b558 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Check that one can replace the entire content of a batch of entities on both Context Source and Context Broker thanks to a inclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes.jsonld +${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D013_01_inc Batch Upsert Entities With Inclusive Registration Without Replace Flag + [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an inclusive registration, these are replaced on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_8 + + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + + Set Stub Reply POST /ngsi-ld/v1/entityOperations/upsert 201 + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + Check Response Status Code 201 ${response.status_code} + + @{expected_entities_ids}= Create List ${entity_id1} ${entity_id2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{upserted_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Vehicle + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${entities_to_be_upserted} ${response1.json()} + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${old_entity1}= Create Entity ${old_entity_payload_filename} ${entity_id1} + ${old_entity2}= Create Entity ${old_entity_payload_filename} ${entity_id2} + + ${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=${EMPTY} + ${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 + @{entities_ids_to_be_deleted}= Create List ${entity_id1} ${entity_id2} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server diff --git a/doc/files/DistributedOperations/Provision/D013_01_inc.json b/doc/files/DistributedOperations/Provision/D013_01_inc.json new file mode 100644 index 00000000..cabd8d73 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_01_inc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/BatchEntitiesUpsert/D013_01_inc", + "test_objective": "Check that one can replace the entire content of a batch of entities on both Context Source and Context Broker thanks to a inclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_01_inc Batch Upsert Entities With Inclusive Registration Without Replace Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/BatchEntitiesUpsert/D013_01_inc", + "doc": "Check that if one requests the Context Broker to replace a batch of entities that match an inclusive registration, these are replaced on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_8", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert", + "robotfile": "D013_01_inc" +} \ No newline at end of file -- GitLab From 9f5e1bfb51ec191d65fcbbe069e5dc9535b65b05 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 4 Dec 2025 16:44:56 +0100 Subject: [PATCH 02/10] fix: correct test case name --- .../D013_01_inc.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/{BatchEntitiesUpsert => UpsertBatchEntities}/D013_01_inc.robot (99%) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot similarity index 99% rename from TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot rename to TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot index 0c75b558..731310e9 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/BatchEntitiesUpsert/D013_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot @@ -19,7 +19,7 @@ ${new_entity_payload_filename} vehicle-simple-different-attributes. ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** -D013_01_inc Batch Upsert Entities With Inclusive Registration Without Replace Flag +D013_01_inc Batch Upsert Entities With Inclusive Registration Without Update Flag [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an inclusive registration, these are replaced on the Context Source too [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_8 -- GitLab From c650f181b56988dc5192f99ec8ae58a2284b9b5d Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 12:42:25 +0100 Subject: [PATCH 03/10] feat: add test for inclusive with update option --- .../UpsertBatchEntities/D013_01_inc.robot | 9 +-- .../UpsertBatchEntities/D013_02_inc.robot | 77 +++++++++++++++++++ .../Provision/D013_02_inc.json | 43 +++++++++++ 3 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_inc.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_02_inc.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot index 731310e9..83f8ad91 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot @@ -15,24 +15,23 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${old_entity_payload_filename} vehicle-simple-attributes.jsonld -${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld +${new_entity_payload_filename} vehicle-simple-attributes-second.jsonld ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** -D013_01_inc Batch Upsert Entities With Inclusive Registration Without Update Flag +D013_01_inc Batch Upsert Entities With Inclusive Registration Without Replace Flag [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an inclusive registration, these are replaced on the Context Source too [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_8 ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} Set Stub Reply POST /ngsi-ld/v1/entityOperations/upsert 201 ${response}= Batch Upsert Entities @{entities_to_be_upserted} Check Response Status Code 201 ${response.status_code} - @{expected_entities_ids}= Create List ${entity_id1} ${entity_id2} - @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{upserted_entities_ids} ${response1}= Query Entities ... entity_ids=${expected_updated_entities_ids} @@ -66,4 +65,4 @@ Delete Created Entity And Registration And Stop Context Source Mock Server @{entities_ids_to_be_deleted}= Create List ${entity_id1} ${entity_id2} Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_inc.robot new file mode 100644 index 00000000..02a4453b --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_inc.robot @@ -0,0 +1,77 @@ +*** Settings *** +Documentation Check that one can update the content of a batch of entities on both Context Source and Context Broker thanks to a inclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes.jsonld +${new_entity_payload_filename} vehicle-simple-attributes-second.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D013_02_inc Batch Upsert Entities With Inclusive Registration With Update Flag + [Documentation] Check that if one requests the Context Broker to update a batch of entities that match an inclusive registration, these are 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_8 + ${response}= Retrieve Entity by Id ${entity_id1} context=${ngsild_test_suite_context} + ${old_body}= Get From Dictionary ${response.json()} brandName + + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + + Set Stub Reply POST /ngsi-ld/v1/entityOperations/upsert 201 + ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=update + Check Response Status Code 201 ${response.status_code} + + ${stub}= Get Request Url Params options + Should Contain ${stub} update + + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{upserted_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Vehicle + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + + ${response}= Retrieve Entity by Id ${entity_id1} context=${ngsild_test_suite_context} + ${new_body}= Get From Dictionary ${response.json()} brandName + Should Not Be Equal ${old_body} ${new_body} + Should Contain ${response.json()} isParked2 + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${old_entity1}= Create Entity ${old_entity_payload_filename} ${entity_id1} + ${old_entity2}= Create Entity ${old_entity_payload_filename} ${entity_id2} + + ${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=${EMPTY} + ${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 + @{entities_ids_to_be_deleted}= Create List ${entity_id1} ${entity_id2} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D013_02_inc.json b/doc/files/DistributedOperations/Provision/D013_02_inc.json new file mode 100644 index 00000000..dd1a2625 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_02_inc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_inc", + "test_objective": "Check that one can update the content of a batch of entities on both Context Source and Context Broker thanks to a inclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_02_inc Batch Upsert Entities With Inclusive Registration With Update Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_inc", + "doc": "Check that if one requests the Context Broker to update a batch of entities that match an inclusive registration, these are updated on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_8", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/UpsertBatchEntities", + "robotfile": "D013_02_inc" +} \ No newline at end of file -- GitLab From 425c05039baf87711da4cf302339dbda64a5e08d Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 13:11:08 +0100 Subject: [PATCH 04/10] feat: add new test for redirect --- .../UpsertBatchEntities/D013_01_red.robot | 71 +++++++++++++++++++ .../Provision/D013_01_red.json | 43 +++++++++++ 2 files changed, 114 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_01_red.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot new file mode 100644 index 00000000..bdeba1af --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Check that one can replace the entire content of a batch of entities on the Context Source thanks to a redirect registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Setup Entity Id And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes.jsonld +${new_entity_payload_filename} vehicle-simple-attributes-second.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D013_01_red Batch Upsert Entities With Redirect Registration Without Replace Flag + [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_8 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 + Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/upsert 201 + + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + Check Response Status Code 201 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Setup Entity Id And Registration And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${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=${EMPTY} + ... 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_id} + ... ${registration_payload_file_path} + ... entity_id=${EMPTY} + ... mode=redirect + ... endpoint=/broker2 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Context Source Registration ${registration_id2} + Stop Context Source Mock Server \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D013_01_red.json b/doc/files/DistributedOperations/Provision/D013_01_red.json new file mode 100644 index 00000000..f467c3ae --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_01_red.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_01_red", + "test_objective": "Check that one can replace the entire content of a batch of entities on the Context Source thanks to a redirect registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Setup Entity Id And Registration And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity id set to ${entity_id}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_01_red Batch Upsert Entities With Redirect Registration Without Replace Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_01_red", + "doc": "Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_8", + "cf_06", + "dist-ops", + "proxy-redirect", + "since_v1.6.1" + ], + "setup": "Setup Entity Id And Registration And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/UpsertBatchEntities", + "robotfile": "D013_01_red" +} \ No newline at end of file -- GitLab From 6428b23120b92d9e152a4358e9c335e78a9a26d0 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 14:55:39 +0100 Subject: [PATCH 05/10] feat: add test for redirect with replace flag --- .../UpsertBatchEntities/D013_02_red.robot | 74 +++++++++++++++++++ .../Provision/D013_02_red.json | 43 +++++++++++ 2 files changed, 117 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_02_red.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot new file mode 100644 index 00000000..d58364ec --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot @@ -0,0 +1,74 @@ +*** Settings *** +Documentation Check that one can replace the content of a batch of entities on the Context Source thanks to a redirect registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Setup Entity Id And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes.jsonld +${new_entity_payload_filename} vehicle-simple-attributes-second.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D013_02_red Batch Upsert Entities With Redirect Registration With Replace Flag + [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_8 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 + Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/upsert 201 + + ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=replace + Check Response Status Code 201 ${response.status_code} + + ${stub}= Get Request Url Params options + Should Contain ${stub} replace + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Setup Entity Id And Registration And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${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=${EMPTY} + ... 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_id} + ... ${registration_payload_file_path} + ... entity_id=${EMPTY} + ... mode=redirect + ... endpoint=/broker2 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Context Source Registration ${registration_id2} + Stop Context Source Mock Server \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D013_02_red.json b/doc/files/DistributedOperations/Provision/D013_02_red.json new file mode 100644 index 00000000..d540dcc2 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_02_red.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_red", + "test_objective": "Check that one can replace the content of a batch of entities on the Context Source thanks to a redirect registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Setup Entity Id And Registration And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity id set to ${entity_id}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_02_red Batch Upsert Entities With Redirect Registration With Replace Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_red", + "doc": "Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_8", + "cf_06", + "dist-ops", + "proxy-redirect", + "since_v1.6.1" + ], + "setup": "Setup Entity Id And Registration And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/UpsertBatchEntities", + "robotfile": "D013_02_red" +} \ No newline at end of file -- GitLab From 6df01d60b24f0780e35dc43d63f477915bd86538 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 14:57:23 +0100 Subject: [PATCH 06/10] fix: wrong flag name --- .../BatchEntities/UpsertBatchEntities/D013_02_red.robot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot index d58364ec..2337c425 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot @@ -26,12 +26,12 @@ D013_02_red Batch Upsert Entities With Redirect Registration With Replace Flag Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/upsert 201 - ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=replace + ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=update Check Response Status Code 201 ${response.status_code} ${stub}= Get Request Url Params options - Should Contain ${stub} replace - + Should Contain ${stub} update + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert Should Be Equal ${stub_count} 1 ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entityOperations/upsert -- GitLab From af3d5f19060304afc2d9e73675aba9d90a88a9be Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 15:21:01 +0100 Subject: [PATCH 07/10] fix: improve tests logic --- .../BatchEntities/UpsertBatchEntities/D013_01_inc.robot | 2 +- .../BatchEntities/UpsertBatchEntities/D013_01_red.robot | 7 ++++++- .../BatchEntities/UpsertBatchEntities/D013_02_red.robot | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot index 83f8ad91..16ae9cb0 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_inc.robot @@ -19,7 +19,7 @@ ${new_entity_payload_filename} vehicle-simple-attributes-second.jso ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** -D013_01_inc Batch Upsert Entities With Inclusive Registration Without Replace Flag +D013_01_inc Batch Upsert Entities With Inclusive Registration Without Update Flag [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an inclusive registration, these are replaced on the Context Source too [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_8 diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot index bdeba1af..8daf7627 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_red.robot @@ -19,10 +19,15 @@ ${new_entity_payload_filename} vehicle-simple-attributes-second.jso ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** -D013_01_red Batch Upsert Entities With Redirect Registration Without Replace Flag +D013_01_red Batch Upsert Entities With Redirect Registration Without Update Flag [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_8 + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/upsert 201 diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot index 2337c425..494e8d31 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot @@ -19,10 +19,15 @@ ${new_entity_payload_filename} vehicle-simple-attributes-second.jso ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld *** Test Cases *** -D013_02_red Batch Upsert Entities With Redirect Registration With Replace Flag +D013_02_red Batch Upsert Entities With Redirect Registration With Update Flag [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_6_8 + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/upsert 201 -- GitLab From 76945f7d6602742a2089798845b6caabbde3c6e2 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 15:24:40 +0100 Subject: [PATCH 08/10] feat: new test for exclusive --- .../UpsertBatchEntities/D013_01_exc.robot | 65 +++++++++++++++++++ .../Provision/D013_01_exc.json | 43 ++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_exc.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_01_exc.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_exc.robot new file mode 100644 index 00000000..5161cbb4 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_01_exc.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that one can replace the entire content of a batch of entities on the Context Source and on the Context Broker thanks to an exclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld +${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Flag + [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an exclusive registration, these are replaced on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_8 + + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 + + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + Check Response Status Code 201 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${old_entity1}= Create Entity ${old_entity_payload_filename} ${entity_id1} local=true + ${old_entity2}= Create Entity ${old_entity_payload_filename} ${entity_id2} local=true + + ${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=${EMPTY} + ... 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 + @{entities_ids_to_be_deleted}= Create List ${entity_id1} ${entity_id2} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + Stop Context Source Mock Server \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D013_01_exc.json b/doc/files/DistributedOperations/Provision/D013_01_exc.json new file mode 100644 index 00000000..bf480c66 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_01_exc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_01_exc", + "test_objective": "Check that one can replace the entire content of a batch of entities on the Context Source and on the Context Broker thanks to an exclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_01_exc", + "doc": "Check that if one requests the Context Broker to replace a batch of entities that match an exclusive registration, these are replaced on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_8", + "cf_06", + "dist-ops", + "proxy-exclusive", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/UpsertBatchEntities", + "robotfile": "D013_01_exc" +} \ No newline at end of file -- GitLab From 6690d3f2809bf10142a66152babe5930f07f7702 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 15:31:25 +0100 Subject: [PATCH 09/10] feat: new exclusive test with update flag --- .../UpsertBatchEntities/D013_02_exc.robot | 68 +++++++++++++++++++ .../Provision/D013_02_exc.json | 43 ++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_exc.robot create mode 100644 doc/files/DistributedOperations/Provision/D013_02_exc.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_exc.robot new file mode 100644 index 00000000..9f6ebedb --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_exc.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that one can update the content of a batch of entities on the Context Source and on the Context Broker thanks to an exclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld +${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag + [Documentation] Check that if one requests the Context Broker to replace a batch of entities that match an exclusive registration, these are replaced on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_8 + + ${new_entity1}= Load Entity ${new_entity_payload_filename} ${entity_id1} + ${new_entity2}= Load Entity ${new_entity_payload_filename} ${entity_id2} + @{entities_to_be_upserted}= Create List ${new_entity1} ${new_entity2} + @{upserted_entities_ids}= Create List ${entity_id1} ${entity_id2} + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/upsert 201 + + ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=update + Check Response Status Code 201 ${response.status_code} + + ${stub}= Get Request Url Params options + Should Contain ${stub} update + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${old_entity1}= Create Entity ${old_entity_payload_filename} ${entity_id1} local=true + ${old_entity2}= Create Entity ${old_entity_payload_filename} ${entity_id2} local=true + + ${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=${EMPTY} + ... 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 + @{entities_ids_to_be_deleted}= Create List ${entity_id1} ${entity_id2} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + Stop Context Source Mock Server \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D013_02_exc.json b/doc/files/DistributedOperations/Provision/D013_02_exc.json new file mode 100644 index 00000000..8f60b1c9 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D013_02_exc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_exc", + "test_objective": "Check that one can update the content of a batch of entities on the Context Source and on the Context Broker thanks to an exclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.8", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete Created Entity And Registration And Stop Context Source Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on the Context Broker\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", + "test_cases": [ + { + "name": "D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_exc", + "doc": "Check that if one requests the Context Broker to replace a batch of entities that match an exclusive registration, these are replaced on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_8", + "cf_06", + "dist-ops", + "proxy-exclusive", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/UpsertBatchEntities", + "robotfile": "D013_02_exc" +} \ No newline at end of file -- GitLab From e56a70b58efacf2d5f068aec8ca9fc155873b103 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 9 Dec 2025 15:34:03 +0100 Subject: [PATCH 10/10] fix: update test documentation --- .../BatchEntities/UpsertBatchEntities/D013_02_red.robot | 2 +- doc/files/DistributedOperations/Provision/D013_02_red.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot index 494e8d31..cc66b5d6 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchEntities/D013_02_red.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can replace the content of a batch of entities on the Context Source thanks to a redirect registration +Documentation Check that one can update the content of a batch of entities on the Context Source thanks to a redirect registration Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource diff --git a/doc/files/DistributedOperations/Provision/D013_02_red.json b/doc/files/DistributedOperations/Provision/D013_02_red.json index d540dcc2..d93ebf93 100644 --- a/doc/files/DistributedOperations/Provision/D013_02_red.json +++ b/doc/files/DistributedOperations/Provision/D013_02_red.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_red", - "test_objective": "Check that one can replace the content of a batch of entities on the Context Source thanks to a redirect registration", + "test_objective": "Check that one can update the content of a batch of entities on the Context Source thanks to a redirect registration", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.8", "config_id": "", "parent_release": "v1.6.1", @@ -18,7 +18,7 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity id set to ${entity_id}\n and the SUT containing a Context Source Registration \n with id equal to ${registration_id}\n and payload set to ${registration_payload_file_path}\n and the SUT containing a Context Source Mock Server\n}", "test_cases": [ { - "name": "D013_02_red Batch Upsert Entities With Redirect Registration With Replace Flag", + "name": "D013_02_red Batch Upsert Entities With Redirect Registration With Update Flag", "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/UpsertBatchEntities/D013_02_red", "doc": "Check that if one requests the Context Broker to replace a batch of entities that match a redirect registration, these are replaced on the Context Source", "tags": [ -- GitLab