From e005b5543da7d392f0f1cf2fe7e66b1eb2cae83a Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 2 Feb 2026 17:10:37 +0100 Subject: [PATCH 1/3] feat: add create tests for first interoperabilty case --- .../Entities/CreateEntity/IOP_CNF_01_01.robot | 72 +++++++++++++++++++ .../Entities/CreateEntity/IOP_CNF_01_02.robot | 72 +++++++++++++++++++ ...ext-source-registration-auxiliary-1.jsonld | 18 +++++ ...ext-source-registration-auxiliary-2.jsonld | 22 ++++++ ...ext-source-registration-exclusive-1.jsonld | 21 ++++++ ...ext-source-registration-exclusive-2.jsonld | 22 ++++++ ...ext-source-registration-inclusive-1.jsonld | 18 +++++ ...ext-source-registration-inclusive-2.jsonld | 22 ++++++ ...text-source-registration-redirect-1.jsonld | 18 +++++ ...text-source-registration-redirect-2.jsonld | 21 ++++++ .../offstreet-parking1-full.jsonld | 34 +++++++++ .../offstreet-parking2-full.jsonld | 34 +++++++++ .../ContextInformationConsumption.resource | 4 +- .../ContextInformationProvision.resource | 5 +- .../ContextSourceRegistration.resource | 23 +++--- 15 files changed, 394 insertions(+), 12 deletions(-) create mode 100644 TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot create mode 100644 TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-auxiliary-1.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-auxiliary-2.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-exclusive-1.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-inclusive-1.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-redirect-1.jsonld create mode 100644 data/csourceRegistrations/interoperability/context-source-registration-redirect-2.jsonld create mode 100644 data/entities/interoperability/offstreet-parking1-full.jsonld create mode 100644 data/entities/interoperability/offstreet-parking2-full.jsonld diff --git a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot new file mode 100644 index 00000000..c30e6c72 --- /dev/null +++ b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot @@ -0,0 +1,72 @@ +*** Settings *** +Documentation Verify that the broker b2 mirrors the information stored in the b1 broker and broker b3 contains some exclusive data. + +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 + +Test Setup Setup Initial Context Source Registrations +Test Teardown Delete Entities and Delete Registrations + +*** Variables *** +${entity_payload_filename} interoperability/offstreet-parking1-full.jsonld +${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld +${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld +${registration_id1} urn:ngsi-ld:ContextSourceRegistration:Inclusive:2 +${registration_id2} urn:ngsi-ld:ContextSourceRegistration:Exclusive:2 +${entity_id} urn:ngsi-ld:OffStreetParking:1 +${b1_url} +${b2_url} +${b3_url} + +*** Test Cases *** +IOP_CNF_01_01 Create Entity In B1 And Retrieve Entity In All Brokers + [Documentation] Check that entities are created in b1 and b2 but not in b3. + [Tags] 6_1 I6_1_1_1 Inclusive Exclusive Interoperability + + ${expected_payload}= Load Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity From File ${entity_payload_filename} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b1_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Be Equal ${response.json()} ${expected_payload} + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b2_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Contain ${response.json()} availableSpotsNumber + Should Contain ${response.json()} totalSpotsNumber + Should Not Contain ${response.json()} location + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b3_url} + Check Response Status Code 404 ${response.status_code} + +*** Keywords *** +Setup Initial Context Source Registrations + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id1} + ... ${inclusive_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b2_url} + ... mode=inclusive + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id2} + ... ${exclusive_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b3_url} + ... mode=exclusive + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + +Delete Entities And Delete Registrations + Delete Context Source Registration ${registration_id1} broker_url=${b1_url} + Delete Context Source Registration ${registration_id2} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b2_url} + Delete Entity By Id ${entity_id} broker_url=${b3_url} \ No newline at end of file diff --git a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot new file mode 100644 index 00000000..820939b7 --- /dev/null +++ b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot @@ -0,0 +1,72 @@ +*** Settings *** +Documentation Verify that the brokers b1 and b2 do not contain an exclusive attributes found in the b3 broker. + +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 Initial Context Source Registrations +Test Teardown Delete Entities and Delete Registrations + +*** Variables *** +${entity_payload_filename} interoperability/offstreet-parking2-full.jsonld +${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld +${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld +${registration_id1} urn:ngsi-ld:ContextSourceRegistration:Inclusive:2 +${registration_id2} urn:ngsi-ld:ContextSourceRegistration:Exclusive:2 +${entity_id} urn:ngsi-ld:OffStreetParking:2 +${b1_url} +${b2_url} +${b3_url} + +*** Test Cases *** +IOP_CNF_01_02 Create Entity In B1 And Retrieve Entity In All Brokers + [Documentation] Check that, in b1 and b2, the entity does not contain the attribute location, said attribute will be contained in b3 thanks to an exclusive registration. + [Tags] 6_1 I6_1_1_2 Inclusive Exclusive Interoperability + + ${response}= Create Entity From File ${entity_payload_filename} ${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} broker_url=${b1_url} local=true + Check Response Status Code 200 ${response.status_code} + Should Not Contain ${response.json()} location + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} broker_url=${b2_url} local=true + Check Response Status Code 200 ${response.status_code} + Should Not Contain ${response.json()} location + + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} broker_url=${b3_url} local=true + Check Response Status Code 200 ${response.status_code} + Should Contain ${response.json()} location + +*** Keywords *** +Setup Initial Context Source Registrations + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id1} + ... ${inclusive_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b2_url} + ... mode=inclusive + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id2} + ... ${exclusive_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b3_url} + ... mode=exclusive + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + +Delete Entities And Delete Registrations + Delete Context Source Registration ${registration_id1} broker_url=${b1_url} + Delete Context Source Registration ${registration_id2} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b2_url} + Delete Entity By Id ${entity_id} broker_url=${b3_url} diff --git a/data/csourceRegistrations/interoperability/context-source-registration-auxiliary-1.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-auxiliary-1.jsonld new file mode 100644 index 00000000..8fe63a78 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-auxiliary-1.jsonld @@ -0,0 +1,18 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Auxiliary:1", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ] + } + ], + "mode": "auxiliary", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-auxiliary-2.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-auxiliary-2.jsonld new file mode 100644 index 00000000..1d037309 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-auxiliary-2.jsonld @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Auxiliary:2", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ], + "propertyNames": [ + "availableSpotsNumber", + "totalSpotsNumber" + ] + } + ], + "mode": "auxiliary", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-exclusive-1.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-exclusive-1.jsonld new file mode 100644 index 00000000..f11d58de --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-exclusive-1.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Exclusive:1", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:OffStreetParking:2" + } + ], + "propertyNames": [ + "totalSpotsNumber" + ] + } + ], + "mode": "exclusive", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld new file mode 100644 index 00000000..fdc4730a --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Exclusive:2", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:OffStreetParking:2", + "type": "OffStreetParking" + } + ], + "propertyNames": [ + "location" + ] + } + ], + "mode": "exclusive", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-inclusive-1.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-inclusive-1.jsonld new file mode 100644 index 00000000..42145ec1 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-inclusive-1.jsonld @@ -0,0 +1,18 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Inclusive:1", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ] + } + ], + "mode": "inclusive", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld new file mode 100644 index 00000000..4f835c57 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Inclusive:2", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ], + "propertyNames": [ + "availableSpotsNumber", + "totalSpotsNumber" + ] + } + ], + "mode": "inclusive", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-redirect-1.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-redirect-1.jsonld new file mode 100644 index 00000000..754d1c63 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-redirect-1.jsonld @@ -0,0 +1,18 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Redirect:1", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ] + } + ], + "mode": "redirect", + "endpoint": "xxx", + "@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/csourceRegistrations/interoperability/context-source-registration-redirect-2.jsonld b/data/csourceRegistrations/interoperability/context-source-registration-redirect-2.jsonld new file mode 100644 index 00000000..2cc6e981 --- /dev/null +++ b/data/csourceRegistrations/interoperability/context-source-registration-redirect-2.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:Redirect:2", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "OffStreetParking" + } + ], + "propertyNames": [ + "location" + ] + } + ], + "mode": "redirect", + "endpoint": "xxx", + "@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/interoperability/offstreet-parking1-full.jsonld b/data/entities/interoperability/offstreet-parking1-full.jsonld new file mode 100644 index 00000000..d9edbd75 --- /dev/null +++ b/data/entities/interoperability/offstreet-parking1-full.jsonld @@ -0,0 +1,34 @@ +{ + "id": "urn:ngsi-ld:OffStreetParking:1", + "type": "OffStreetParking", + "name": { + "type": "Property", + "value": "Downtown One" + }, + "availableSpotsNumber": { + "type": "Property", + "value": 121, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.7 + } + }, + "totalSpotsNumber": { + "type": "Property", + "value": 200 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "@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/interoperability/offstreet-parking2-full.jsonld b/data/entities/interoperability/offstreet-parking2-full.jsonld new file mode 100644 index 00000000..0260a332 --- /dev/null +++ b/data/entities/interoperability/offstreet-parking2-full.jsonld @@ -0,0 +1,34 @@ +{ + "id": "urn:ngsi-ld:OffStreetParking:2", + "type": "OffStreetParking", + "name": { + "type": "Property", + "value": "Downtown Two" + }, + "availableSpotsNumber": { + "type": "Property", + "value": 112, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.4 + } + }, + "totalSpotsNumber": { + "type": "Property", + "value": 150 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.45, + 41.2 + ] + } + }, + "@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/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index a80e892a..1036917b 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -244,9 +244,11 @@ Retrieve Entity by Id ... ${context}=${EMPTY} ... ${local}=${EMPTY} ... ${options}=${EMPTY} + ... ${broker_url}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} + ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} Set To Dictionary ${headers} Accept ${accept} IF '${context}'!='' ${context_link}= Build Context Link ${context} @@ -259,7 +261,7 @@ Retrieve Entity by Id Set To Dictionary ${params} options=${options} END ${response}= GET - ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} + ... url=${final_url}/${ENTITIES_ENDPOINT_PATH}${id} ... headers=${headers} ... params=${params} ... expected_status=any diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index a38e9d8b..fc61c48a 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -207,11 +207,12 @@ Create Entity Selecting Content Type RETURN ${response} Create Entity From File - [Arguments] ${filename} + [Arguments] ${filename} ${broker_url}=${EMPTY} ${file_content}= Get File ${EXECDIR}/data/entities/${filename} + ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST - ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... url=${final_url}/${ENTITIES_ENDPOINT_PATH} ... data=${file_content} ... headers=${headers} ... expected_status=any diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index e4d2d98e..64de511d 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -31,9 +31,10 @@ Prepare Context Source Registration From File ... ${entity_id_pattern}=${EMPTY} ... ${mode}=${EMPTY} ... ${endpoint}=${EMPTY} + ... ${broker_url}=${EMPTY} ... ${operations}=[] - ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} + ${final_context_source_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${context_source_url} ${registration_payload}= Update Value To JSON ... ${payload} ... $.id @@ -41,7 +42,7 @@ Prepare Context Source Registration From File ${registration_payload}= Update Value To JSON ... ${registration_payload} ... $..endpoint - ... ${context_source_url}${endpoint} + ... ${final_context_source_url}${endpoint} IF '${entity_id}' != '' ${dict}= Create Dictionary id=${entity_id} ${registration_payload}= Add Object To JSON @@ -85,8 +86,10 @@ Create Context Source Registration RETURN ${response} Create Context Source Registration With Return - [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} + [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} ${broker_url}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + # Se broker_url non รจ passato, usa la variabile globale ${url} + ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} IF '${accept}'!='' Set To Dictionary ${headers} Accept=${context} END @@ -97,7 +100,7 @@ Create Context Source Registration With Return ... Link=${context_link} END ${response}= POST - ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} + ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} ... json=${payload} ... headers=${headers} ... expected_status=any @@ -105,16 +108,18 @@ Create Context Source Registration With Return RETURN ${response} Delete Context Source Registration - [Arguments] ${context_source_registration_id} - - ${response}= DELETE url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} + [Arguments] ${context_source_registration_id} ${broker_url}=${EMPTY} + + ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} + ${response}= DELETE url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} Output ${response} Delete Context Source Registration RETURN ${response} Delete Context Source Registration With Return - [Arguments] ${registration_id} + [Arguments] ${registration_id} ${broker_url}=${EMPTY} + ${final_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${url} ${response}= DELETE - ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} + ... url=${final_url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} ... expected_status=any Output ${response} Delete Context Source Registration RETURN ${response} -- GitLab From 4a2fd98252cf478313df8df0824e5f43c9edae61 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 2 Feb 2026 18:03:26 +0100 Subject: [PATCH 2/3] fix: random id for CSR --- .../Provision/Entities/CreateEntity/IOP_CNF_01_01.robot | 7 +++++-- .../Provision/Entities/CreateEntity/IOP_CNF_01_02.robot | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot index c30e6c72..58a364ec 100644 --- a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot +++ b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_01.robot @@ -15,8 +15,6 @@ Test Teardown Delete Entities and Delete Registrations ${entity_payload_filename} interoperability/offstreet-parking1-full.jsonld ${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld ${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld -${registration_id1} urn:ngsi-ld:ContextSourceRegistration:Inclusive:2 -${registration_id2} urn:ngsi-ld:ContextSourceRegistration:Exclusive:2 ${entity_id} urn:ngsi-ld:OffStreetParking:1 ${b1_url} ${b2_url} @@ -46,6 +44,9 @@ IOP_CNF_01_01 Create Entity In B1 And Retrieve Entity In All Brokers *** Keywords *** Setup Initial Context Source Registrations + + ${registration_id1}= Generate Random CSR Id + Set Suite Variable ${registration_id1} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id1} ... ${inclusive_registration_payload_file_path} @@ -55,6 +56,8 @@ Setup Initial Context Source Registrations ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} 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} ... ${exclusive_registration_payload_file_path} diff --git a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot index 820939b7..9630f25e 100644 --- a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot +++ b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_01_02.robot @@ -17,8 +17,6 @@ Test Teardown Delete Entities and Delete Registrations ${entity_payload_filename} interoperability/offstreet-parking2-full.jsonld ${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld ${exclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-exclusive-2.jsonld -${registration_id1} urn:ngsi-ld:ContextSourceRegistration:Inclusive:2 -${registration_id2} urn:ngsi-ld:ContextSourceRegistration:Exclusive:2 ${entity_id} urn:ngsi-ld:OffStreetParking:2 ${b1_url} ${b2_url} @@ -46,6 +44,9 @@ IOP_CNF_01_02 Create Entity In B1 And Retrieve Entity In All Brokers *** Keywords *** Setup Initial Context Source Registrations + + ${registration_id1}= Generate Random CSR Id + Set Suite Variable ${registration_id1} ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id1} ... ${inclusive_registration_payload_file_path} @@ -55,6 +56,8 @@ Setup Initial Context Source Registrations ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} 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} ... ${exclusive_registration_payload_file_path} -- GitLab From d9c21d122437323f74f077f1cdbb29f6b6a0f912 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Mon, 2 Feb 2026 18:04:30 +0100 Subject: [PATCH 3/3] feat: new test with four brokers --- .../Entities/CreateEntity/IOP_CNF_02_01.robot | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_02_01.robot diff --git a/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_02_01.robot b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_02_01.robot new file mode 100644 index 00000000..8a24de4b --- /dev/null +++ b/TP/NGSI-LD/Interoperability/Provision/Entities/CreateEntity/IOP_CNF_02_01.robot @@ -0,0 +1,93 @@ +*** Settings *** +Documentation Verify that broker b2 mirrors the information in b1 and the b3 and b4 brokers contain only the location property. + +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 + +Test Setup Setup Initial Context Source Registrations +Test Teardown Delete Entities and Delete Registrations + +*** Variables *** +${entity_payload_filename} interoperability/offstreet-parking1-full.jsonld +${inclusive_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld +${redirect_registration_payload_file_path} csourceRegistrations/interoperability/context-source-registration-redirect-2.jsonld +${entity_id} urn:ngsi-ld:OffStreetParking:1 +${b1_url} +${b2_url} +${b3_url} +${b4_url} + +*** Test Cases *** +IOP_CNF_02_01 Create Entity In B1 And Retrieve Entity In All Brokers + [Documentation] Check that entities are created in b1 and b2 but not in b3. + [Tags] 6_1 I6_1_2_1 Inclusive Redirect Interoperability + + ${expected_payload}= Load Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity From File ${entity_payload_filename} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b1_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Not Contain ${response.json()} location + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b2_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Not Contain ${response.json()} location + Should Not Contain ${response.json()} name + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b3_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Contain ${response.json()} location + + ${response}= Retrieve Entity by Id ${entity_id} local=true broker_url=${b4_url} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Should Contain ${response.json()} location + +*** Keywords *** +Setup Initial Context Source Registrations + + ${registration_id1}= Generate Random CSR Id + Set Suite Variable ${registration_id1} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id1} + ... ${inclusive_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b2_url} + ... mode=inclusive + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + 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} + ... ${redirect_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b3_url} + ... mode=redirect + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + + ${registration_id3}= Generate Random CSR Id + Set Suite Variable ${registration_id3} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id3} + ... ${redirect_registration_payload_file_path} + ... entity_id=${entity_id} + ... broker_url=${b4_url} + ... mode=redirect + ${response}= Create Context Source Registration With Return ${registration_payload} broker_url=${b1_url} + Check Response Status Code 201 ${response.status_code} + +Delete Entities And Delete Registrations + Delete Context Source Registration ${registration_id1} broker_url=${b1_url} + Delete Context Source Registration ${registration_id2} broker_url=${b1_url} + Delete Context Source Registration ${registration_id3} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b1_url} + Delete Entity By Id ${entity_id} broker_url=${b2_url} + Delete Entity By Id ${entity_id} broker_url=${b3_url} + Delete Entity By Id ${entity_id} broker_url=${b4_url} \ No newline at end of file -- GitLab