From bdc618f698ac7ab4e1172e8f52833c6012062c1f Mon Sep 17 00:00:00 2001 From: kzangeli Date: Wed, 3 Jun 2026 20:02:10 +0200 Subject: [PATCH 1/2] fix(D009_01_red,D013_01_red,D013_02_red): second CSR posted with the first CSR's id The setups generate ${registration_id2} for the second (broker2) redirect registration but then pass ${registration_id} - the FIRST registration's id - to Prepare Context Source Registration From File. The second POST /csourceRegistrations therefore reuses an existing registration id and any spec-conformant broker answers 409 AlreadyExists ("registration '...' already exists"), failing the suite setup and cascading the test. Pass ${registration_id2}, as D006_01_red (the sibling that gets it right) already does. Note the teardowns already delete BOTH ids, confirming the two-registrations intent. With the setup fixed the three tests proceed to their actual bodies (which currently fail on separate, separately-documented issues: name-wrapped attribute fragments, stub query-back, Get Request Url Params in stub mode). --- .../BatchEntities/UpsertBatchOfEntities/D013_01_red.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/D013_02_red.robot | 2 +- .../EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot index 772417a9..236b6b2d 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot @@ -67,7 +67,7 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_id_pattern=${entity_pattern} ... mode=redirect diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot index 2ef07cd7..0eb1bd3b 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot @@ -70,7 +70,7 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_pattern=${entity_pattern} ... mode=redirect diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot index 607661c1..b43e0a82 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot @@ -77,7 +77,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload2}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_id=${entity_id} ... mode=redirect -- GitLab From 1b94f5858b3258559ca7439e6b2270fc8523ea09 Mon Sep 17 00:00:00 2001 From: kzangeli Date: Wed, 3 Jun 2026 20:22:54 +0200 Subject: [PATCH 2/2] fix(distops): exclusive-CSR setups must be id-specific and not overlap local data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nine DistOps tests failed at suite setup against a broker that enforces TS 104-175 § 9.3.3 on registration creation: 1. idPattern exclusives (400) — D013_01_exc, D013_02_exc, D014_01_exc, D014_02_exc, D016_01_exc registered ONE exclusive CSR with entity_id_pattern=urn:ngsi-ld:Vehicle:*. § 9.3.3: "an id pattern or Entity type defining a group of entities is not supported for exclusive registrations". New fixture context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld carries two id-specific information[] elements (one per batch entity, each with propertyNames:["speed"]) — still one registration, one endpoint, one stub, so the stub_count=1 assertions hold. The Prepare keyword gains an optional entity_id2= (appended last, callers by name) that injects the second id into $.information[1].entities[*]. 2. local-overlap (409) — D005_01_exc, D009_01_exc (and D014_01/02_exc) created the entities from vehicle-simple-different-attributes (speed, isParked2) BEFORE registering an exclusive CSR on speed. The broker shall hold no local data for exclusively-registered attributes, so creation-time conflict checking answers 409. Create from vehicle-simple-attributes-second (brandName, isParked2) instead — keeps the isParked2 the D005 assertions track, drops the local speed. § 9.3.3 explicitly permits unregistered attributes locally. 3. redirect + local entity (409) — D006_01_red, D006_02_red created the entity locally and then registered two redirect CSRs over it. For redirect, "the Context Broker itself holds no data locally in conflict to the registration". The bodies never touch the local entity (pure forward assertions), so simply drop the local create. Also: D013_01/02_exc asserted the forwarded batch body contains the FULL entities; an exclusive forward carries only the registered slice (chop-and-forward), so assert containment of the entity ids and the registered attribute instead. Verified against swBroker: D013_01_exc, D014_01_exc, D016_01_exc, D006_01_red, D006_02_red now PASS end-to-end; D013_02_exc/D014_02_exc proceed to the known Get-Request-Url-Params stub-mode crash, D005_01_exc to the name-wrapped-fragment issue, D009_01_exc to the GET-stub body/query-match issues — all separately documented. --- .../MergeBatchOfEntities/D016_01_exc.robot | 5 ++-- .../UpdateBatchOfEntities/D014_01_exc.robot | 7 +++-- .../UpdateBatchOfEntities/D014_02_exc.robot | 7 +++-- .../UpsertBatchOfEntities/D013_01_exc.robot | 11 +++---- .../UpsertBatchOfEntities/D013_02_exc.robot | 11 +++---- .../DeleteEntityAttributes/D006_01_red.robot | 2 -- .../DeleteEntityAttributes/D006_02_red.robot | 2 -- .../PartialAttributeUpdate/D005_01_exc.robot | 2 +- .../ReplaceEntityAttribute/D009_01_exc.robot | 2 +- ...icle-speed-with-batch-ops-exclusive.jsonld | 29 +++++++++++++++++++ .../ContextSourceRegistration.resource | 8 +++++ 11 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot index 905ebd5d..d25c51a6 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${entity_second_payload_filename} vehicle-simple-attributes-second-different.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D016_01_exc Merge Batch Entities On Both Context Broker And Context Source @@ -63,7 +63,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot index e427a829..f2049b11 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot @@ -14,10 +14,10 @@ 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-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${update_payload_filename} expectations/vehicle-replace-isParked-attribute.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D014_01_exc Update Batch Entities without noOverwrite Option @@ -53,7 +53,8 @@ Setup Registration And Start Context Source Mock Server ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot index c41048db..cb09941b 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot @@ -12,10 +12,10 @@ 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-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${update_payload_filename} expectations/vehicle-replace-isParked-attribute.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D014_02_exc Update Batch Entities with noOverwrite Option @@ -54,7 +54,8 @@ Setup Registration And Start Context Source Mock Server ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot index e6650adf..985b6ff0 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld ${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Flag @@ -35,9 +35,9 @@ D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Fla Wait for redirected request ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Should Contain ${payload} ${new_first_entity} - Should Contain ${payload} ${new_second_entity} + Should Contain ${request_payload} ${first_entity_id} + Should Contain ${request_payload} ${second_entity_id} + Should Contain ${request_payload} speed ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert Should Be Equal ${stub_count} 1 @@ -57,7 +57,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot index 9164cffe..0905d7f5 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld ${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag @@ -39,9 +39,9 @@ D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag Wait for redirected request ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Should Contain ${payload} ${new_first_entity} - Should Contain ${payload} ${new_second_entity} + Should Contain ${request_payload} ${first_entity_id} + Should Contain ${request_payload} ${second_entity_id} + Should Contain ${request_payload} speed ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert Should Be Equal ${stub_count} 1 @@ -61,7 +61,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot index 5f29ce52..46e0aed5 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot @@ -44,8 +44,6 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id Set Suite Variable ${registration_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot index 99a72a27..359284ea 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot @@ -44,8 +44,6 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id Set Suite Variable ${registration_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot index 02645df3..2d14ade7 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot @@ -15,7 +15,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${fragment_filename} vehicle-speed-two-datasetid-01-fragment.jsonld ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld ${attribute_id} speed diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot index 8ecd2e10..4f03bcfc 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${entity_attribute_filename} fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld new file mode 100644 index 00000000..5961a605 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + }, + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID2", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps", "createBatch", "upsertBatch", "updateBatch", "deleteBatch", "mergeBatch"], + "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" + ] +} diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index 5263add9..6c334031 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -33,6 +33,7 @@ Prepare Context Source Registration From File ... ${endpoint}=${EMPTY} ... ${broker_url}=${EMPTY} ... ${operations}=[] + ... ${entity_id2}=${EMPTY} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${final_context_source_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${context_source_url} @@ -51,6 +52,13 @@ Prepare Context Source Registration From File ... $..entities[*] ... ${dict} END + IF '${entity_id2}' != '' + ${dict}= Create Dictionary id=${entity_id2} + ${registration_payload}= Add Object To JSON + ... ${registration_payload} + ... $.information[1].entities[*] + ... ${dict} + END IF '${entity_id_pattern}' != '' ${dict}= Create Dictionary idPattern=${entity_id_pattern} ${registration_payload}= Add Object To JSON -- GitLab