From 5ff82a58ffa796a49494963f97092d1cffdbe3f0 Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Wed, 4 Sep 2024 10:41:26 +0200 Subject: [PATCH 01/34] feat: 1.6.1 for CSR create-retrieve-delete (33-35-36) --- .../035_01.robot | 4 --- .../{033_01_01.robot => 033_01.robot} | 21 +++++++++-- .../{033_01_03.robot => 033_11.robot} | 4 +-- .../{033_01_02.robot => 033_12.robot} | 20 +++++++---- ...source-registration-csourceProperty.jsonld | 4 --- ...ontext-source-registration-location.jsonld | 3 ++ .../context-source-registration-no-id.jsonld | 8 +---- ...source-registration-past-expiration.jsonld | 6 ---- ...source-registration-with-expiration.jsonld | 8 +---- ...gistration-with-mode-and-operations.jsonld | 36 +++++++++++++++++++ ...egistration-without-mode-operations.jsonld | 34 ++++++++++++++++++ .../context-source-registration.jsonld | 10 ++---- ...t-source-registration-expanded-format.json | 29 ++------------- .../context-source-registration.json | 8 ++--- 14 files changed, 115 insertions(+), 80 deletions(-) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_01.robot => 033_01.robot} (66%) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_03.robot => 033_11.robot} (93%) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_02.robot => 033_12.robot} (71%) create mode 100644 data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld create mode 100644 data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot index 08bdca8a7..d8db41e78 100644 --- a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot @@ -7,7 +7,6 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Context Source Registrations -Test Teardown Delete Created Context Source Registrations *** Variables *** @@ -37,6 +36,3 @@ Setup Initial Context Source Registrations ${create_response}= Create Context Source Registration With Return ${updated_payload} Check Response Status Code 201 ${create_response.status_code} Set Test Variable ${registration_id} - -Delete Created Context Source Registrations - Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot similarity index 66% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index ac196405b..ff1f69a68 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Teardown Delete Created Context Source Registrations +Test Template Create Context Source Registration *** Variables *** @@ -16,14 +17,30 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** 033_01_01 Create Context Source Registration With Specific Date Expiration Date + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-with-expiration.jsonld +033_01_02 Create Context Source Registration That Never Expires + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration.jsonld +033_01_03 Create Context Source Registration With Non Default Mode And Operations + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld +033_01_04 Create Context Source Registration With Location + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-location.jsonld + + +*** Keywords *** +Create Context Source Registration [Documentation] Check that one can create a context source registration with specific ID and expiration date - [Tags] csr-create 5_9_2 + [Arguments] ${registration_payload_file_path} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${registration_id} ${response.headers} ${response1}= Retrieve Context Source Registration ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} @@ -31,7 +48,5 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ${ignored_attributes}= Create List ${status_regex_expr} Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} - -*** Keywords *** Delete Created Context Source Registrations Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot similarity index 93% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index 55d7e7938..ca26cbf61 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -15,9 +15,9 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** -033_01_03 Create Context Source Registration Without Specifying an ID +033_11 Create Context Source Registration Without Specifying an ID [Documentation] Check that one can create a context source registration without specifying an ID - [Tags] csr-create 5_9_2 + [Tags] csr-create 5_9_2 since_v1.6.1 ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration With Return ${payload} Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot similarity index 71% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot index 236dc7e6f..cc7887308 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can create a context source registration that never expires +Documentation Check that one can create a context source registration without default mode and operations Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -11,17 +11,19 @@ Suite Teardown Delete Created Context Source Registrations *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-without-mode-operations.jsonld *** Test Cases *** -033_01_02 Create Context Source Registration That Never Expires - [Documentation] Check that one can create a context source registration that never expires - [Tags] csr-create 5_9_2 +033_12 Create Context Source Registration Without Mode And Operation + [Documentation] Check that one can create a context source registration without mode and operations + [Tags] csr-create 5_9_2 since_v1.6.1 ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${registration_id} ${response.headers} @@ -29,8 +31,12 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + + ${ignored_attributes}= Create List ${status_regex_expr} mode operations + ${expected_payload}= Add Object To Json ${registration_payload} $.mode inclusive + ${operations}= Create List federationOps + ${expected_payload}= Add Object To Json ${expected_payload} $.operations ${operations} + Check Created Resource Set To ${expected_payload} ${response1.json()} ${ignored_attributes} *** Keywords *** diff --git a/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld b/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld index a76f1967c..63bbdf425 100644 --- a/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld +++ b/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld @@ -10,10 +10,6 @@ ] } ], - "location":{ - "type":"Point", - "coordinates":[-8.521,41.2] - }, "endpoint":"http://my.csource.org:1026", "csourceProperty1": "aValue", "csourceProperty2": "anotherValue", diff --git a/data/csourceRegistrations/context-source-registration-location.jsonld b/data/csourceRegistrations/context-source-registration-location.jsonld index a5603e7b8..1f49d2885 100644 --- a/data/csourceRegistrations/context-source-registration-location.jsonld +++ b/data/csourceRegistrations/context-source-registration-location.jsonld @@ -14,8 +14,11 @@ "type":"Point", "coordinates":[-8.521,41.2] }, + "mode": "inclusive", + "operations": ["federationOps"], "endpoint":"http://my.csource.org:1026", "@context":[ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] + } \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-no-id.jsonld b/data/csourceRegistrations/context-source-registration-no-id.jsonld index 484ed252c..0361c4954 100644 --- a/data/csourceRegistrations/context-source-registration-no-id.jsonld +++ b/data/csourceRegistrations/context-source-registration-no-id.jsonld @@ -26,13 +26,7 @@ "relationshipNames": ["isNextToBuilding"] } ], - "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - }, + "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/data/csourceRegistrations/context-source-registration-past-expiration.jsonld b/data/csourceRegistrations/context-source-registration-past-expiration.jsonld index 6078f7b0d..f3c7395d9 100644 --- a/data/csourceRegistrations/context-source-registration-past-expiration.jsonld +++ b/data/csourceRegistrations/context-source-registration-past-expiration.jsonld @@ -28,12 +28,6 @@ } ], "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - }, "expiresAt": " 2018-11-29T14:53:15Z", "@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/data/csourceRegistrations/context-source-registration-with-expiration.jsonld b/data/csourceRegistrations/context-source-registration-with-expiration.jsonld index 0dbf966b7..30c64748e 100644 --- a/data/csourceRegistrations/context-source-registration-with-expiration.jsonld +++ b/data/csourceRegistrations/context-source-registration-with-expiration.jsonld @@ -27,13 +27,7 @@ "relationshipNames": ["isNextToBuilding"] } ], - "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - }, + "endpoint": "http://my.csource.org:1026", "expiresAt": "2025-11-29T14:53:15Z", "@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/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld new file mode 100644 index 000000000..7d8cf9373 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld @@ -0,0 +1,36 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "mode": "exclusive", + "operations": ["queryEntity","queryTemporal","updateOps"], + "endpoint": "http://my.csource.org:1026", + "@context": [ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld new file mode 100644 index 000000000..264253325 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld @@ -0,0 +1,34 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "@context": [ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration.jsonld b/data/csourceRegistrations/context-source-registration.jsonld index d24b35fd8..f19fee30b 100644 --- a/data/csourceRegistrations/context-source-registration.jsonld +++ b/data/csourceRegistrations/context-source-registration.jsonld @@ -27,13 +27,9 @@ "relationshipNames": ["isNextToBuilding"] } ], - "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - }, + "mode": "inclusive", + "operations": ["federationOps"], + "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/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json index c557935b3..03e4a0d1a 100644 --- a/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json +++ b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json @@ -38,31 +38,6 @@ ] } ], - "location": { - "type": "Polygon", - "coordinates": [ - [ - [ - 100.0, - 0.0 - ], - [ - 101.0, - 0.0 - ], - [ - 101.0, - 1.0 - ], - [ - 100.0, - 1.0 - ], - [ - 100.0, - 0.0 - ] - ] - ] - } + "mode": "inclusive", + "operations": ["federationOps"] } diff --git a/data/csourceRegistrations/expectations/context-source-registration.json b/data/csourceRegistrations/expectations/context-source-registration.json index a534ebc79..fdc4541e1 100644 --- a/data/csourceRegistrations/expectations/context-source-registration.json +++ b/data/csourceRegistrations/expectations/context-source-registration.json @@ -28,10 +28,6 @@ } ], "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - } + "mode": "inclusive", + "operations": ["federationOps"] } \ No newline at end of file -- GitLab From 022157932b5aa9a75e074586d4be7c04ef45d47b Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Mon, 9 Dec 2024 15:05:21 +0100 Subject: [PATCH 02/34] fix: PR comments + some errors in 033 test --- .../RegisterContextSource/033_01.robot | 19 ++++++++------ .../RegisterContextSource/033_02.robot | 8 +++--- .../RegisterContextSource/033_11.robot | 6 +++-- .../RegisterContextSource/033_12.robot | 7 ++---- ...gistration-with-mode-and-operations.jsonld | 2 +- ...egistration-without-mode-operations.jsonld | 2 +- resources/AssertionUtils.resource | 25 +++++++++++++------ 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index ff1f69a68..bae8e85fd 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -15,29 +15,29 @@ ${registration_id_prefix}= urn:ngsi-ld:Registration: ${registration_payload_file_path}= csourceRegistrations/context-source-registration-with-expiration.jsonld -*** Test Cases *** +*** Test Cases *** FILENAME HAS_MODE 033_01_01 Create Context Source Registration With Specific Date Expiration Date - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-with-expiration.jsonld 033_01_02 Create Context Source Registration That Never Expires - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration.jsonld 033_01_03 Create Context Source Registration With Non Default Mode And Operations [Tags] csr-create 5_9_2 since_v1.6.1 - csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld + csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld ${True} 033_01_04 Create Context Source Registration With Location - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-location.jsonld *** Keywords *** Create Context Source Registration [Documentation] Check that one can create a context source registration with specific ID and expiration date - [Arguments] ${registration_payload_file_path} + [Arguments] ${registration_payload_file_path} ${has_mode}=${False} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} - ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${registration_payload}= Update Value To JSON ${payload} $.id ${registration_id} ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${registration_id} ${response.headers} @@ -46,6 +46,11 @@ Create Context Source Registration ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List ${status_regex_expr} + + IF ${has_mode} == ${False} + Append To List ${ignored_attributes} mode operations + END + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} Delete Created Context Source Registrations diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot index b68aee121..bd0005ec1 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot @@ -13,12 +13,12 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** -033_02_01 Create a context source registration with invalid JSON file - [Documentation] Create a context source registration with invalid JSON file +033_02_01 Create a context source registration with invalid content + [Documentation] Check that one cannot create a context source with invalid content [Tags] csr-create 5_9_2 - ${subscription_payload}= Get File ${EXECDIR}/data/${registration_payload_file_path} + ${csr_payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration - ... ${subscription_payload} + ... ${csr_payload} Check Response Status Code 400 ${response.status_code} Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Title When Using Session Request ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index ca26cbf61..7558a3519 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -29,8 +29,10 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + Check Response Body Containing Context Source Registration element + ... ${registration_payload_file_path} + ... ${registration_id} + ... ${response1.json()} *** Keywords *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot index cc7887308..1d63c8d13 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot @@ -32,11 +32,8 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} mode operations - ${expected_payload}= Add Object To Json ${registration_payload} $.mode inclusive - ${operations}= Create List federationOps - ${expected_payload}= Add Object To Json ${expected_payload} $.operations ${operations} - Check Created Resource Set To ${expected_payload} ${response1.json()} ${ignored_attributes} + ${ignored_attributes}= Create List ${status_regex_expr} mode operations timesSent timesFailed + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} *** Keywords *** diff --git a/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld index 7d8cf9373..27f2ab169 100644 --- a/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld +++ b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld @@ -31,6 +31,6 @@ "operations": ["queryEntity","queryTemporal","updateOps"], "endpoint": "http://my.csource.org:1026", "@context": [ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + "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/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld index 264253325..cc9fb6f00 100644 --- a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld +++ b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld @@ -29,6 +29,6 @@ ], "endpoint": "http://my.csource.org:1026", "@context": [ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + "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/AssertionUtils.resource b/resources/AssertionUtils.resource index 8181cd509..ed4f1f629 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -21,6 +21,7 @@ ${lastNotification_regex_expr}= root\\['lastNotification'\\] ${timesFailed_regex_expr}= root\\['timesFailed'\\] ${timesSent_regex_expr}= root\\['timesSent'\\] ${is_active_expr}= root\\['isActive'\\] +${context_source_ignored_regex_expr}= root\\['@context'\\] *** Keywords *** @@ -305,14 +306,24 @@ Check Response Body Containing Number Of Entities Check Response Body Containing Context Source Registration element [Arguments] ${expectation_filename} ${context_source_registration_id} ${response_body} - ${context_source_registration_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} - ${context_source_registration}= Update Value To JSON - ... ${context_source_registration_payload} - ... $.id - ... ${context_source_registration_id} - ${ignored_keys}= Create List ${context_regex_expr} + ${expectation_json}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + + ${id_dict}= Create Dictionary id=${context_source_registration_id} + ${expectation_json_with_id}= Add Object To JSON ${expectation_json} $ ${id_dict} + + Log To Console context_source_registration_id + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + + Log To Console expectation_json_with_id + Log To Console ${expectation_json_with_id} + Log To Console response_body + Log To Console ${response_body} + ${ignored_keys}= Create List ${context_regex_expr} mode operations ${comparison_result}= Compare Dictionaries Ignoring Keys - ... ${context_source_registration} + ... ${expectation_json_with_id} ... ${response_body} ... ${ignored_keys} Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} -- GitLab From c7167bc12077e9f977a32fd69f57ba391149a66b Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Mon, 9 Dec 2024 15:29:02 +0100 Subject: [PATCH 03/34] fix: PR comments --- .../RegisterContextSource/033_01.robot | 12 +++--- .../RegisterContextSource/033_11.robot | 2 +- .../RegisterContextSource/033_12.robot | 41 ------------------- ...ontext-source-registration-location.jsonld | 2 - ...egistration-without-mode-operations.jsonld | 34 --------------- .../context-source-registration.jsonld | 2 - resources/AssertionUtils.resource | 10 ----- 7 files changed, 7 insertions(+), 96 deletions(-) delete mode 100644 TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot delete mode 100644 data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index bae8e85fd..75e200bec 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -16,18 +16,18 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** FILENAME HAS_MODE -033_01_01 Create Context Source Registration With Specific Date Expiration Date - [Tags] csr-create 5_9_2 - csourceRegistrations/context-source-registration-with-expiration.jsonld -033_01_02 Create Context Source Registration That Never Expires +033_01_01 Create Context Source Registration Without Mode And Operation [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration.jsonld -033_01_03 Create Context Source Registration With Non Default Mode And Operations +033_01_02 Create Context Source Registration With Non Default Mode And Operations [Tags] csr-create 5_9_2 since_v1.6.1 csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld ${True} -033_01_04 Create Context Source Registration With Location +033_01_03 Create Context Source Registration With Location [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-location.jsonld +033_01_04 Create Context Source Registration With Specific Date Expiration Date + [Tags] csr-create 5_9_2 + csourceRegistrations/context-source-registration-with-expiration.jsonld *** Keywords *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index 7558a3519..43f81eac0 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -17,7 +17,7 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** 033_11 Create Context Source Registration Without Specifying an ID [Documentation] Check that one can create a context source registration without specifying an ID - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration With Return ${payload} Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot deleted file mode 100644 index 1d63c8d13..000000000 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot +++ /dev/null @@ -1,41 +0,0 @@ -*** Settings *** -Documentation Check that one can create a context source registration without default mode and operations - -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -Suite Teardown Delete Created Context Source Registrations - - -*** Variables *** -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-without-mode-operations.jsonld - - -*** Test Cases *** -033_12 Create Context Source Registration Without Mode And Operation - [Documentation] Check that one can create a context source registration without mode and operations - [Tags] csr-create 5_9_2 since_v1.6.1 - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - Set Suite Variable ${registration_id} - ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} - - ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} - - ${response}= Create Context Source Registration With Return ${registration_payload} - Check Response Status Code 201 ${response.status_code} - Check Response Headers Containing URI set to ${registration_id} ${response.headers} - ${response1}= Retrieve Context Source Registration - ... context_source_registration_id=${registration_id} - ... context=${ngsild_test_suite_context} - ... accept=${CONTENT_TYPE_LD_JSON} - - ${ignored_attributes}= Create List ${status_regex_expr} mode operations timesSent timesFailed - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} - - -*** Keywords *** -Delete Created Context Source Registrations - Delete Context Source Registration ${registration_id} diff --git a/data/csourceRegistrations/context-source-registration-location.jsonld b/data/csourceRegistrations/context-source-registration-location.jsonld index 1f49d2885..0c2cb3e02 100644 --- a/data/csourceRegistrations/context-source-registration-location.jsonld +++ b/data/csourceRegistrations/context-source-registration-location.jsonld @@ -14,8 +14,6 @@ "type":"Point", "coordinates":[-8.521,41.2] }, - "mode": "inclusive", - "operations": ["federationOps"], "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/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld deleted file mode 100644 index cc9fb6f00..000000000 --- a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", - "type": "ContextSourceRegistration", - "information": [ - { - "entities": [ - { - "id": "urn:ngsi-ld:Vehicle:A456", - "type": "Vehicle" - } - ], - "propertyNames": ["brandName","speed"], - "relationshipNames": ["isParked"] - }, - { - "entities": [ - { - "idPattern": ".*downtown$", - "type": "OffStreetParking" - }, - { - "idPattern": ".*47$", - "type": "OffStreetParking" - } - ], - "propertyNames": ["availableSpotNumber","totalSpotNumber"], - "relationshipNames": ["isNextToBuilding"] - } - ], - "endpoint": "http://my.csource.org:1026", - "@context": [ - "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" - ] -} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration.jsonld b/data/csourceRegistrations/context-source-registration.jsonld index f19fee30b..49ab16e12 100644 --- a/data/csourceRegistrations/context-source-registration.jsonld +++ b/data/csourceRegistrations/context-source-registration.jsonld @@ -27,8 +27,6 @@ "relationshipNames": ["isNextToBuilding"] } ], - "mode": "inclusive", - "operations": ["federationOps"], "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/AssertionUtils.resource b/resources/AssertionUtils.resource index ed4f1f629..477856e19 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -311,16 +311,6 @@ Check Response Body Containing Context Source Registration element ${id_dict}= Create Dictionary id=${context_source_registration_id} ${expectation_json_with_id}= Add Object To JSON ${expectation_json} $ ${id_dict} - Log To Console context_source_registration_id - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - - Log To Console expectation_json_with_id - Log To Console ${expectation_json_with_id} - Log To Console response_body - Log To Console ${response_body} ${ignored_keys}= Create List ${context_regex_expr} mode operations ${comparison_result}= Compare Dictionaries Ignoring Keys ... ${expectation_json_with_id} -- GitLab From f20410a1f73195a258086d51f485e099121b869e Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 27 Feb 2025 09:47:02 +0100 Subject: [PATCH 04/34] feat(wip): bootstrap mock support for dist ops --- .../Entities/CreateEntity/D001_01_inc.robot | 32 +++++++++++++------ .../ContextSourceRegistration.resource | 7 ++-- resources/MockServerUtils.resource | 3 ++ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot index c12ddea75..5f1128765 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to create entities on both Context Broker and Context Source +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to create entities on both Context Broker and Context Source Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -7,9 +7,10 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity Id And Registration -Test Teardown Delete Created Entities And Registration +Test Setup Setup Entity Id And Registration +Test Teardown Delete Created Entities And Registration *** Variables *** @@ -18,13 +19,28 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D001_01_inc Create Entity On Both Context Broker and Context Source + [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration, this is created 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_1 - [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration, this is created on the Context Source too + + Set Stub Reply POST /ngsi-ld/v1/entities 201 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 201 ${response.status_code} + # Works after adding these two lines in venv/lib/python3.12/site-packages/HttpCtrl/http_handler.py + # at line 86-87: + # request = Request(host, port, method, self.path, self.headers, body) + # RequestStorage().push(request) + Wait for redirected request + + ${request_payload}= Get Request Body + ${payload}= Evaluate json.loads('''${request_payload}''') json + Log ${payload} + ${request_headers}= Get Request Headers + Log ${request_headers} + @{entities_id}= Create List ${entity_id} ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} Check Response Status Code 200 ${response_query.status_code} @@ -40,17 +56,15 @@ Setup Entity Id And Registration ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index 1a9ce76f2..2c0a0dd13 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -17,12 +17,13 @@ ${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/err ${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound ${response} ${EMPTY} +${context_source_url} http://${context_source_host}:${context_source_port} *** Keywords *** Prepare Context Source Registration From File [Arguments] ${id} ${registration_file} ${entity_id}=${EMPTY} ${mode}=${EMPTY} - + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${registration_payload}= Update Value To JSON ... ${payload} @@ -31,7 +32,7 @@ Prepare Context Source Registration From File ${registration_payload}= Update Value To JSON ... ${registration_payload} ... $..endpoint - ... ${context_source_endpoint} + ... ${context_source_url} IF '${entity_id}' != '' ${dict}= Create Dictionary id=${entity_id} ${registration_payload}= Add Object To JSON @@ -39,7 +40,7 @@ Prepare Context Source Registration From File ... $..entities[*] ... ${dict} END - IF '${mode}' != '' + IF '${mode}' != '' ${dict}= Create Dictionary mode=${mode} ${registration_payload}= Add Object To JSON ... ${registration_payload} diff --git a/resources/MockServerUtils.resource b/resources/MockServerUtils.resource index 82ef9dc0b..558f5946e 100644 --- a/resources/MockServerUtils.resource +++ b/resources/MockServerUtils.resource @@ -19,6 +19,9 @@ Wait for redirected request Wait For Request ${timeout} Reply By 200 +Answer to Create Entity + Set Stub Reply POST /ngsi-ld/v1/entities 201 + Stop Context Source Mock Server # Terminate HTTP Server Stop Server -- GitLab From f11bbf6f367ec434cc263576904eab75261455ca Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Mon, 28 Apr 2025 13:43:06 +0200 Subject: [PATCH 05/34] added new features in resources --- resources/ApiUtils/ContextInformationConsumption.resource | 4 ++-- resources/ApiUtils/ContextSourceRegistration.resource | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index c240364dc..3815e4c66 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -211,7 +211,7 @@ Retrieve Attributes RETURN ${response} Retrieve Entity by Id - [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${options}=${EMPTY} + [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${base_url}=${url} ${options}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} @@ -226,7 +226,7 @@ Retrieve Entity by Id Set To Dictionary ${params} options=${options} END ${response}= GET - ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} + ... url=${base_url}/${ENTITIES_ENDPOINT_PATH}${id} ... headers=${headers} ... params=${params} ... expected_status=any diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index 2c0a0dd13..b8737ba53 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -22,7 +22,7 @@ ${context_source_url} http://${context_source_host}:${ *** Keywords *** Prepare Context Source Registration From File - [Arguments] ${id} ${registration_file} ${entity_id}=${EMPTY} ${mode}=${EMPTY} + [Arguments] ${id} ${registration_file} ${entity_id}=${EMPTY} ${mode}=${EMPTY} ${endpoint}=${EMPTY} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${registration_payload}= Update Value To JSON @@ -32,7 +32,7 @@ Prepare Context Source Registration From File ${registration_payload}= Update Value To JSON ... ${registration_payload} ... $..endpoint - ... ${context_source_url} + ... ${context_source_url}${endpoint} IF '${entity_id}' != '' ${dict}= Create Dictionary id=${entity_id} ${registration_payload}= Add Object To JSON -- GitLab From cec568689051576ef9ca4ac4dc4a01ea52bfa1ba Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Mon, 28 Apr 2025 13:45:10 +0200 Subject: [PATCH 06/34] updated test cases --- .../Entity/QueryEntities/D011_01_01_inc.robot | 25 +++++++++---- .../Entity/QueryEntities/D011_01_02_inc.robot | 13 ++++--- .../Entity/RetrieveEntity/D010_01_inc.robot | 27 ++++++++++---- .../Entity/RetrieveEntity/D010_02_inc.robot | 13 ++++--- .../Entities/CreateEntity/D001_01_inc.robot | 20 ++++------ .../Entities/CreateEntity/D001_02_inc.robot | 13 +++---- .../CreateEntity/D001_03_01_inc.robot | 26 +++++++++---- .../CreateEntity/D001_03_02_inc.robot | 25 ++++++------- .../CreateEntity/D001_03_03_inc.robot | 16 ++++---- .../Entities/DeleteEntity/D002_01_inc.robot | 17 +++++---- .../DeleteEntity/D002_02_01_inc.robot | 13 +++++-- .../DeleteEntity/D002_02_02_inc.robot | 16 ++++---- .../UpdateEntityAttributes/D004_01_inc.robot | 37 +++++++++++++------ 13 files changed, 153 insertions(+), 108 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot index b6304f16e..b1732c42a 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration @@ -20,19 +21,27 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D011_01_01_inc Query The Context Broker With Type - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets returned - @{entities_id}= Create List ${entity_id} + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} + + Wait for redirected request + + ${received_request}= Get Request Url + Log To Console ${received_request} + ${stub_count}= Get Stub Count GET /ngsi-ld/v1/entities?type=Vehicle + Should Be True ${stub_count} > 0 Check Response Status Code 200 ${response.status_code} - Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + # @{entities_id}= Create List ${entity_id} + # Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} *** Keywords *** Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} + # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} + # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -41,11 +50,11 @@ Setup Entity On Remote And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server Delete Created Entity And Registration Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - + # Delete Entity By Id ${entity_id} base_url=${remote_url} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot index bf6e9b350..956cf95b7 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration @@ -31,8 +32,8 @@ D011_01_02_inc Query The Context Broker With Type And Missing Attribute Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} + # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} + # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -41,11 +42,11 @@ Setup Entity On Remote And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server + Delete Created Entity And Registration - Delete Entity By Id ${entity_id} base_url=${remote_url} + # Delete Entity By Id ${entity_id} base_url=${remote_url} Delete Context Source Registration ${registration_id} - - \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot index 86da79b45..749032872 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot @@ -7,30 +7,39 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D010_01_inc Retrieve entity on a Context Source from the Context Broker - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, entity gets returned + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities/${entity_id} 200 ${entity_body} ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + + Wait for redirected request + + ${stub_count}= Get Stub Count GET /ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + Check Response Status Code 200 ${response.status_code} - Check JSON Value In Response Body ['id'] ${entity_id} ${response.json()} *** Keywords *** Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} + # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} + # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -39,9 +48,11 @@ Setup Entity On Remote And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server + Delete Created Entity And Registration - Delete Entity By Id ${entity_id} base_url=${remote_url} - Delete Context Source Registration ${registration_id} \ No newline at end of file + Delete Context Source Registration ${registration_id} + # Delete Entity By Id ${entity_id} base_url=${remote_url} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot index 47f01248e..d69f26562 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration @@ -29,8 +30,8 @@ D010_02_inc Retrieve entity on a Context Source from the Context Broker with loc Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} + # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} + # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -39,9 +40,11 @@ Setup Entity On Remote And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server + Delete Created Entity And Registration - Delete Entity By Id ${entity_id} base_url=${remote_url} - Delete Context Source Registration ${registration_id} \ No newline at end of file + # Delete Entity By Id ${entity_id} base_url=${remote_url} + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot index 5f1128765..2cf7ac7d9 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot @@ -29,10 +29,6 @@ D001_01_inc Create Entity On Both Context Broker and Context Source ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 201 ${response.status_code} - # Works after adding these two lines in venv/lib/python3.12/site-packages/HttpCtrl/http_handler.py - # at line 86-87: - # request = Request(host, port, method, self.path, self.headers, body) - # RequestStorage().push(request) Wait for redirected request ${request_payload}= Get Request Body @@ -42,13 +38,13 @@ D001_01_inc Create Entity On Both Context Broker and Context Source Log ${request_headers} @{entities_id}= Create List ${entity_id} + ${payload_list} Evaluate [$payload] + Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} + ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} Check Response Status Code 200 ${response_query.status_code} Check Response Body Containing Entities URIS set to ${entities_id} ${response_query.json()} - ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} - Check Response Body Containing Entities URIS set to ${entities_id} ${response_query_remote.json()} - - + *** Keywords *** Setup Entity Id And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -60,11 +56,11 @@ Setup Entity Id And Registration ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} - ${response1}= Create Context Source Registration With Return ${registration_payload} - Check Response Status Code 201 ${response1.status_code} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + Start Context Source Mock Server - Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_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/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index 8b8199002..944f61323 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Initial Context Source Registration Test Teardown Delete Created Registration @@ -21,18 +22,16 @@ ${context_source_registration_payload_file_path} csourceRegistrations/con *** Test Cases *** D001_02_inc Request to create an entity with a malformed id on both Context Broker and Context Source + [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 - [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source + ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 400 ${response.status_code} + Wait For No Request timeout=5 ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} Check Response Status Code 200 ${response_query.status_code} Should Be Empty ${response_query.json()} - ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} - Check Response Status Code 200 ${response_query_remote.status_code} - Should Be Empty ${response_query_remote.json()} - *** Keywords *** Setup Initial Context Source Registration @@ -43,8 +42,8 @@ Setup Initial Context Source Registration ... ${context_source_registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Registration Delete Context Source Registration ${context_source_registration_id} - - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot index 9f1be5172..c69971552 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Local And Registration Test Teardown Delete Created Entities And Registration @@ -20,17 +21,28 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D001_03_01_inc Create entity already existing locally on a Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists locally, this raises an error on the Context Broker but is created correctly on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 + + Set Stub Reply POST /ngsi-ld/v1/entities 201 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][0]['error']} + ${length}= Get Length ${response.json()['errors']} + Should Be Equal As Integers ${length} 1 - @{entities_id}= Create List ${entity_id} - ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} - Check Response Body Containing Entities URIS set to ${entities_id} ${response_query_remote.json()} + Wait for redirected request + ${request_payload}= Get Request Body + ${payload}= Evaluate json.loads('''${request_payload}''') json + Log ${payload} + ${request_headers}= Get Request Headers + Log ${request_headers} + + @{entities_id}= Create List ${entity_id} + ${payload_list} Evaluate [$payload] + Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} *** Keywords *** Setup Entity On Local And Registration @@ -47,11 +59,9 @@ Setup Entity On Local And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot index fdbb41176..d1491ed61 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an entity on a Context Broker and on a Context Source and an inclusive registration on the Context Broker, one is not able to create that entity on the Context Source from the Context Broker +Documentation Verify that, when one has an entity on both Context Broker and Context Source and an inclusive registration on the Context Broker, one is not able to create that entity on the Context Source from the Context Broker Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entities And Registration Test Teardown Delete Created Entities And Registration @@ -20,24 +21,22 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D001_03_02_inc Create entity already existing on both Context Broker and Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists both locally and remotely, this raises an error on both Context Broker and Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 + + Set Stub Reply POST /ngsi-ld/v1/entities 409 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} - - ${length}= Get Length ${response.json()['errors']} - Should Be Equal As Integers ${length} 2 - Should Be Empty ${response.json()['success']} + + Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][0]['error']} + Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][1]['error']} *** Keywords *** Setup Entities And Registration - ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 201 ${response.status_code} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -47,11 +46,9 @@ Setup Entities And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot index 8b3401495..5295d55cd 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entities And Registration @@ -20,24 +21,23 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D001_03_03_inc Create entity already existing remotely on the Context Broker - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists remotely, this raises an error on the Context Source, but it works just fine on the Context Broker + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 + + Set Stub Reply POST /ngsi-ld/v1/entities 409 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} - Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][0]['error']} @{entities_id}= Create List ${entity_id} ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} Check Response Body Containing Entities URIS set to ${entities_id} ${response_query.json()} + *** Keywords *** Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -47,11 +47,9 @@ Setup Entity On Remote And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot index 585956817..5a65460b5 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entities And Registration Test Teardown Delete Created Entities And Registration @@ -20,12 +21,16 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D002_01_inc Delete Entities On Both Context Broker and Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 + + Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 204 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 204 ${response.status_code} - ${response_retrieve}= Retrieve Entity by Id ${entity_id} + ${stub_count}= Get Stub Count DELETE /ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + ${response_retrieve}= Retrieve Entity by Id ${entity_id} local=true Check Response Status Code 404 ${response_retrieve.status_code} *** Keywords *** @@ -34,8 +39,6 @@ Setup Entities And Registration Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 201 ${response.status_code} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -45,11 +48,9 @@ Setup Entities And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entities And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Delete Entity By Id ${entity_id} ${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot index 617b28429..021add0ae 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Local And Registration Test Teardown Delete Created Entity And Registration @@ -20,12 +21,17 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D002_02_01_inc Delete Entity On The Context Broker - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 + + Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 404 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 207 ${response.status_code} Check JSON Value In Response Body ['status'] 404 ${response.json()['errors'][0]['error']} + ${response_retrieve}= Retrieve Entity by Id ${entity_id} local=true + Check Response Status Code 404 ${response_retrieve.status_code} + *** Keywords *** Setup Entity On Local And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -41,10 +47,9 @@ Setup Entity On Local And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entity And Registration Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - - - \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot index f9dffb0ea..122141340 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration @@ -20,18 +21,21 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D002_02_02_inc Delete Entity On a Context Source - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 + + Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 204 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 207 ${response.status_code} + Check JSON Value In Response Body ['status'] 404 ${response.json()['errors'][0]['error']} + ${length}= Get Length ${response.json()['errors']} + Should Be Equal As Integers ${length} 1 *** Keywords *** Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -41,10 +45,8 @@ Setup Entity On Remote And Registration ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server Delete Created Entity And Registration Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot index 72117cb75..6b0fc2dcb 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Setup Entity On Remote And Registration Test Teardown Delete Created Entity And Registration @@ -21,41 +22,53 @@ ${fragment_filename} vehicle-brandname-fragment.jsonld *** Test Cases *** D004_01_inc Query The Context Broker With Type - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 + Set Stub Reply PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 ${response}= Update Entity Attributes ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 204 ${response.status_code} + + Wait for redirected request + Check Response Status Code 204 ${response.status_code} + ${stub_count}= Get Stub Count PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + + ${request_payload}= Get Request Body + ${payload}= Evaluate json.loads('''${request_payload}''') json + Log ${payload} + ${request_headers}= Get Request Headers + Log ${request_headers} + @{entities_id}= Create List ${entity_id} - ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} - Check Response Status Code 200 ${response_query_remote.status_code} - Check Response Body Containing Entities URIS set to ${entities_id} ${response_query_remote.json()} + # ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} + # Check Response Status Code 200 ${response_query_remote.status_code} + ${payload_list} Evaluate [$payload] + Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} *** Keywords *** Setup Entity On Remote And Registration ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} + # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} + # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server Delete Created Entity And Registration Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} - - \ No newline at end of file + # Delete Entity By Id ${entity_id} base_url=${remote_url} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From a8b5cc003f8b413a1d016174d1e4285c413e418b Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 6 May 2025 13:21:28 +0200 Subject: [PATCH 07/34] added new data --- ...istration-vehicle-complete-auxiliary.jsonld | 18 ++++++++++++++++++ .../vehicle-brandname-complete-fragment.jsonld | 7 +++++++ .../vehicle-simple-attributes-second.json | 17 +++++++++++++++++ data/entities/vehicle-simple-attributes.json | 6 +++++- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld create mode 100644 data/entities/fragmentEntities/vehicle-brandname-complete-fragment.jsonld create mode 100644 data/entities/vehicle-simple-attributes-second.json diff --git a/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld new file mode 100644 index 000000000..2967d8864 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld @@ -0,0 +1,18 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Vehicle" + } + ] + } + ], + "endpoint": "http://my.csource.org:1026", + "mode": "auxiliary", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-brandname-complete-fragment.jsonld b/data/entities/fragmentEntities/vehicle-brandname-complete-fragment.jsonld new file mode 100644 index 000000000..2abdf96e9 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-brandname-complete-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "brandname": { + "type": "Property", + "value": "BMW" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-second.json b/data/entities/vehicle-simple-attributes-second.json new file mode 100644 index 000000000..abe88009a --- /dev/null +++ b/data/entities/vehicle-simple-attributes-second.json @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "BMW" + }, + "isParked2": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown2", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Alice" + } + } +} \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes.json b/data/entities/vehicle-simple-attributes.json index 9825fa9f6..729e5f34e 100644 --- a/data/entities/vehicle-simple-attributes.json +++ b/data/entities/vehicle-simple-attributes.json @@ -8,6 +8,10 @@ "isParked": { "type": "Relationship", "object": "urn:ngsi-ld:OffStreetParking:Downtown1", - "observedAt": "2017-07-29T12:00:04Z" + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } } } \ No newline at end of file -- GitLab From f542dfc9e9648a8220ca0141680e3f5a8592d9f5 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 6 May 2025 13:23:27 +0200 Subject: [PATCH 08/34] fixed an error in AssertionUtils --- resources/AssertionUtils.resource | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 477856e19..318342466 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -109,7 +109,7 @@ Check Response Headers ID Not Empty Check Response Body Containing an Attribute set to [Arguments] ${expected_attribute_name} ${response_body} ${expected_attribute_value}=${EMPTY} Should Not Be Empty ${response_body['${expected_attribute_name}']} - IF '${expected_attribute_value}'!='' + IF ${expected_attribute_value}!='' Should Be Equal ${response_body['${expected_attribute_name}']} ${expected_attribute_value} END -- GitLab From c8c17ee94b15e1895fd639c27acc47880505cafa Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 6 May 2025 13:25:47 +0200 Subject: [PATCH 09/34] Modified distributed operations tests --- .../Entity/QueryEntities/D011_01_01_inc.robot | 29 +++++++------------ .../Entity/QueryEntities/D011_01_02_inc.robot | 16 +++++----- .../Entity/QueryEntities/D011_01_03_inc.robot | 28 +++++++++--------- .../Entity/QueryEntities/D011_01_04_inc.robot | 25 ++++++++-------- .../Entity/QueryEntities/D011_01_05_inc.robot | 25 +++++++++------- .../Entity/QueryEntities/D011_02_inc.robot | 21 +++++++------- .../Entity/RetrieveEntity/D010_01_inc.robot | 19 ++++-------- .../Entity/RetrieveEntity/D010_02_inc.robot | 16 +++++----- .../Entities/CreateEntity/D001_01_inc.robot | 17 ++++------- .../Entities/CreateEntity/D001_02_inc.robot | 9 +++--- .../CreateEntity/D001_03_01_inc.robot | 17 ++++------- .../CreateEntity/D001_03_02_inc.robot | 9 +++--- .../CreateEntity/D001_03_03_inc.robot | 9 +++--- .../Entities/DeleteEntity/D002_01_inc.robot | 9 +++--- .../DeleteEntity/D002_02_01_inc.robot | 9 +++--- .../DeleteEntity/D002_02_02_inc.robot | 9 +++--- .../UpdateEntityAttributes/D004_01_inc.robot | 24 +++++---------- 17 files changed, 123 insertions(+), 168 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot index b1732c42a..350e5fbd0 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot @@ -9,13 +9,13 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld @@ -23,25 +23,18 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D011_01_01_inc Query The Context Broker With Type [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets returned [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 - Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} - Wait for redirected request - - ${received_request}= Get Request Url - Log To Console ${received_request} - ${stub_count}= Get Stub Count GET /ngsi-ld/v1/entities?type=Vehicle - Should Be True ${stub_count} > 0 Check Response Status Code 200 ${response.status_code} - # @{entities_id}= Create List ${entity_id} - # Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + @{entities_id}= Create List ${entity_id} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -53,8 +46,6 @@ Setup Entity On Remote And Registration Start Context Source Mock Server -Delete Created Entity And Registration +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - # Delete Entity By Id ${entity_id} base_url=${remote_url} - Stop Context Source Mock Server - \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot index 956cf95b7..3ab077642 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** @@ -21,19 +21,20 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D011_01_02_inc Query The Context Broker With Type And Missing Attribute - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 [Documentation] Check that if one queries for type and an attribute that is missing, no entity gets returned + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} ${response}= Query Entities entity_types=Vehicle attrs=speed context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -46,7 +47,6 @@ Setup Entity On Remote And Registration -Delete Created Entity And Registration - # Delete Entity By Id ${entity_id} base_url=${remote_url} +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot index 5723af41f..b4677e0dd 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot @@ -7,29 +7,33 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Create Entities With Different Payloads And Registration -Test Teardown Delete Created Entities And Registration +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 *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${entity_payload_filename} vehicle-simple-attributes.jsonld -${entity_payload_filename2} vehicle-simple-attributes-second.jsonld +${entity_payload_filename2} vehicle-simple-attributes-second.json ${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-entities.jsonld *** Test Cases *** D011_01_03_inc Query The Context Broker With Type and Attribute - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 [Documentation] Check that if one queries for attribute present in an entity on a Context Source, only that entity gets returned - @{entities_id}= Create List ${second_entity_id} + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + ${entity_body}= Load Entity ${entity_payload_filename2} ${second_entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} + ${response}= Query Entities entity_types=Vehicle attrs=isParked2 context=${ngsild_test_suite_context} Check Response Status Code 200 ${response.status_code} + @{entities_id}= Create List ${second_entity_id} Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} *** Keywords *** -Create Entities With Different Payloads And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${first_entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${first_entity_id} ${response}= Create Entity ${entity_payload_filename} ${first_entity_id} @@ -37,8 +41,6 @@ Create Entities With Different Payloads And Registration ${second_entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${second_entity_id} - ${response1}= Create Entity ${entity_payload_filename2} ${second_entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response1.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -47,12 +49,10 @@ Create Entities With Different Payloads And Registration ... ${registration_payload_file_path} ${response2}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response2.status_code} - + Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${first_entity_id} - Delete Entity By Id ${second_entity_id} base_url=${remote_url} - - + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot index ba74cf0b2..5b65606ea 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot @@ -7,31 +7,33 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Create Entities With Different Payloads And Registration -Test Teardown Delete Created Entities And Registration +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 *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes.json ${entity_payload_filename2} vehicle-simple-attributes-second.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D011_01_04_inc Query The Context Broker With Type and Attribute In Neither - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 [Documentation] Check that if one queries for attribute present in neither of the entities, neither of them gets returned + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + ${entity_body}= Load Entity ${entity_payload_filename} ${first_entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} + ${response}= Query Entities entity_types=Vehicle attrs=speed context=${ngsild_test_suite_context} Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} *** Keywords *** -Create Entities With Different Payloads And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${first_entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${first_entity_id} - ${response}= Create Entity ${entity_payload_filename} ${first_entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} ${second_entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${second_entity_id} @@ -45,12 +47,11 @@ Create Entities With Different Payloads And Registration ... ${registration_payload_file_path} ${response2}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response2.status_code} - + Start Context Source Mock Server -Delete Created Entities And Registration + +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Delete Entity By Id ${first_entity_id} base_url=${remote_url} Delete Entity By Id ${second_entity_id} - - + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot index 6ede4defa..082ac614f 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot @@ -7,21 +7,25 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Create Entities With Different Payloads And Registration -Test Teardown Delete Created Entities And Registration +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 *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes.json ${entity_payload_filename2} vehicle-simple-different-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D011_01_05_inc Query The Context Broker With Type - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 [Documentation] Check that entities on the Context Broker and Context Source with the same id get merged and returned as one entity + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-auxiliary 4_3_6_2 5_7_2 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} + @{entities_id}= Create List ${entity_id} ${expected}= Load JSON From File ${EXECDIR}/data/entities/${entity_payload_filename} ${expected2}= Load JSON From File ${EXECDIR}/data/entities/${entity_payload_filename2} @@ -36,11 +40,9 @@ D011_01_05_inc Query The Context Broker With Type *** Keywords *** -Create Entities With Different Payloads And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} ${response}= Create Entity ${entity_payload_filename2} ${entity_id} Check Response Status Code 201 ${response.status_code} @@ -52,11 +54,12 @@ Create Entities With Different Payloads And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server -Delete Created Entities And Registration + +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} Delete Entity By Id ${entity_id} - + Stop Context Source Mock Server + diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot index c76a0dcc4..a7ab42c9f 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot @@ -7,9 +7,10 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.re Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** @@ -20,18 +21,18 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi *** Test Cases *** D011_02_inc Query The Context Broker With Local Flag - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 6_3_18 [Documentation] Check that if one queries with the local flag, no entity from Context Source gets returned + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 6_3_18 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} local=true Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -40,11 +41,11 @@ Setup Entity On Remote And Registration ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} - + Start Context Source Mock Server -Delete Created Entity And Registration - Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} base_url=${remote_url} +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot index 749032872..37cf39262 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: @@ -22,24 +22,16 @@ ${registration_payload_file_path} csourceRegistrations/context-source-re D010_01_inc Retrieve entity on a Context Source from the Context Broker [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, entity gets returned [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 - ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} Set Stub Reply GET /ngsi-ld/v1/entities/${entity_id} 200 ${entity_body} ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} - - Wait for redirected request - - ${stub_count}= Get Stub Count GET /ngsi-ld/v1/entities/${entity_id} - Should Be True ${stub_count} > 0 Check Response Status Code 200 ${response.status_code} *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -52,7 +44,6 @@ Setup Entity On Remote And Registration -Delete Created Entity And Registration +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - # Delete Entity By Id ${entity_id} base_url=${remote_url} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot index d69f26562..fd7850e30 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot @@ -9,29 +9,28 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld *** Test Cases *** D010_02_inc Retrieve entity on a Context Source from the Context Broker with local flag - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 6_3_18 [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker with local flag, entity not found error is raised + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 6_3_18 ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} local=true + + Wait For No Request Check Response Status Code 404 ${response.status_code} *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -44,7 +43,6 @@ Setup Entity On Remote And Registration -Delete Created Entity And Registration - # Delete Entity By Id ${entity_id} base_url=${remote_url} +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot index 2cf7ac7d9..9c903c00c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity Id And Registration -Test Teardown Delete Created Entities And Registration +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 *** @@ -24,21 +24,14 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D001_01_inc Create Entity On Both Context Broker and Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration, this is created 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_1 - Set Stub Reply POST /ngsi-ld/v1/entities 201 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 201 ${response.status_code} Wait for redirected request - ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Log ${payload} - ${request_headers}= Get Request Headers - Log ${request_headers} - + ${payload_list}= Evaluate [json.loads('''${request_payload}''')] json @{entities_id}= Create List ${entity_id} - ${payload_list} Evaluate [$payload] Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} @@ -46,7 +39,7 @@ D001_01_inc Create Entity On Both Context Broker and Context Source Check Response Body Containing Entities URIS set to ${entities_id} ${response_query.json()} *** Keywords *** -Setup Entity Id And Registration +Setup Entity Id And Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} @@ -60,7 +53,7 @@ Setup Entity Id And Registration Check Response Status Code 201 ${response.status_code} Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index 944f61323..a7acf268d 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Initial Context Source Registration -Test Teardown Delete Created Registration +Test Setup Setup Initial Context Source Registration And Start Context Source Mock Server +Test Teardown Delete Created Registration And Stop Context Source Mock Server *** Variables *** @@ -24,7 +24,6 @@ ${context_source_registration_payload_file_path} csourceRegistrations/con D001_02_inc Request to create an entity with a malformed id on both Context Broker and Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 - ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 400 ${response.status_code} @@ -34,7 +33,7 @@ D001_02_inc Request to create an entity with a malformed id on both Context Brok Should Be Empty ${response_query.json()} *** Keywords *** -Setup Initial Context Source Registration +Setup Initial Context Source Registration And Start Context Source Mock Server ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${context_source_registration_id} ${registration_payload}= Prepare Context Source Registration From File @@ -44,6 +43,6 @@ Setup Initial Context Source Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Registration +Delete Created Registration And Stop Context Source Mock Server Delete Context Source Registration ${context_source_registration_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot index c69971552..524155a2a 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Local And Registration -Test Teardown Delete Created Entities And Registration +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 *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D001_03_01_inc Create entity already existing locally on a Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists locally, this raises an error on the Context Broker but is created correctly on the Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 - Set Stub Reply POST /ngsi-ld/v1/entities 201 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} @@ -33,19 +32,13 @@ D001_03_01_inc Create entity already existing locally on a Context Source Should Be Equal As Integers ${length} 1 Wait for redirected request - ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Log ${payload} - ${request_headers}= Get Request Headers - Log ${request_headers} - + ${payload_list}= Evaluate [json.loads('''${request_payload}''')] json @{entities_id}= Create List ${entity_id} - ${payload_list} Evaluate [$payload] Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} *** Keywords *** -Setup Entity On Local And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} @@ -61,7 +54,7 @@ Setup Entity On Local And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot index d1491ed61..e7ab3e37a 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entities And Registration -Test Teardown Delete Created Entities And Registration +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 *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D001_03_02_inc Create entity already existing on both Context Broker and Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists both locally and remotely, this raises an error on both Context Broker and Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 - Set Stub Reply POST /ngsi-ld/v1/entities 409 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} @@ -32,7 +31,7 @@ D001_03_02_inc Create entity already existing on both Context Broker and Context Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][1]['error']} *** Keywords *** -Setup Entities And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} @@ -48,7 +47,7 @@ Setup Entities And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot index 5295d55cd..18397409f 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entities And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server *** Variables *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D001_03_03_inc Create entity already existing remotely on the Context Broker [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists remotely, this raises an error on the Context Source, but it works just fine on the Context Broker [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_3 - Set Stub Reply POST /ngsi-ld/v1/entities 409 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} @@ -35,7 +34,7 @@ D001_03_03_inc Create entity already existing remotely on the Context Broker *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} @@ -49,7 +48,7 @@ Setup Entity On Remote And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot index 5a65460b5..d77ea2b41 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entities And Registration -Test Teardown Delete Created Entities And Registration +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 *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D002_01_inc Delete Entities On Both Context Broker and Context Source [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 - Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 204 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 204 ${response.status_code} @@ -34,7 +33,7 @@ D002_01_inc Delete Entities On Both Context Broker and Context Source Check Response Status Code 404 ${response_retrieve.status_code} *** Keywords *** -Setup Entities And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} @@ -50,7 +49,7 @@ Setup Entities And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entities And Registration +Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot index 021add0ae..02df311b6 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Local And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D002_02_01_inc Delete Entity On The Context Broker [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 - Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 404 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 207 ${response.status_code} @@ -33,7 +32,7 @@ D002_02_01_inc Delete Entity On The Context Broker Check Response Status Code 404 ${response_retrieve.status_code} *** Keywords *** -Setup Entity On Local And Registration +Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} ${response}= Create Entity ${entity_payload_filename} ${entity_id} @@ -49,7 +48,7 @@ Setup Entity On Local And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entity And Registration +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot index 122141340..3f5c7fd93 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** @@ -23,7 +23,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D002_02_02_inc Delete Entity On a Context Source [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_3 - Set Stub Reply DELETE /ngsi-ld/v1/entities/${entity_id} 204 ${response}= Delete Entity by Id ${entity_id} Check Response Status Code 207 ${response.status_code} @@ -33,7 +32,7 @@ D002_02_02_inc Delete Entity On a Context Source Should Be Equal As Integers ${length} 1 *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} @@ -47,6 +46,6 @@ Setup Entity On Remote And Registration Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server -Delete Created Entity And Registration +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot index 6b0fc2dcb..c35a0dbcc 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot @@ -9,8 +9,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Entity On Remote And Registration -Test Teardown Delete Created Entity And Registration +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** @@ -18,31 +18,24 @@ ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld -${fragment_filename} vehicle-brandname-fragment.jsonld +${fragment_filename} vehicle-brandname-complete-fragment.jsonld *** Test Cases *** D004_01_inc Query The Context Broker With Type [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_2 - Set Stub Reply PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + Set Stub Reply PATCH /ngsi-ld/v1/entities/${entity_id}/attrs 204 ${response}= Update Entity Attributes ... ${entity_id} ... ${fragment_filename} ... ${CONTENT_TYPE_LD_JSON} Wait for redirected request - Check Response Status Code 204 ${response.status_code} + Check Response Status Code 207 ${response.status_code} ${stub_count}= Get Stub Count PATCH /ngsi-ld/v1/entities/${entity_id}/attrs/ Should Be True ${stub_count} > 0 - ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Log ${payload} - ${request_headers}= Get Request Headers - Log ${request_headers} - - @{entities_id}= Create List ${entity_id} # ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} # Check Response Status Code 200 ${response_query_remote.status_code} @@ -51,11 +44,9 @@ D004_01_inc Query The Context Broker With Type *** Keywords *** -Setup Entity On Remote And Registration +Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} Set Suite Variable ${entity_id} - # ${response}= Create Entity ${entity_payload_filename} ${entity_id} base_url=${remote_url} - # Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} @@ -68,7 +59,6 @@ Setup Entity On Remote And Registration Start Context Source Mock Server -Delete Created Entity And Registration +Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - # Delete Entity By Id ${entity_id} base_url=${remote_url} Stop Context Source Mock Server \ No newline at end of file -- GitLab From 6b4a81b0d13cca31d5beab607337a55bfe439197 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 20 May 2025 10:45:36 +0200 Subject: [PATCH 10/34] updated initial_setup.py --- .../Entities/CreateEntity/D001_02_inc.robot | 4 +- doc/analysis/initial_setup.py | 57 +++++-------------- 2 files changed, 15 insertions(+), 46 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index a7acf268d..6f307dda6 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -9,7 +9,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Initial Context Source Registration And Start Context Source Mock Server +Test Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Created Registration And Stop Context Source Mock Server @@ -33,7 +33,7 @@ D001_02_inc Request to create an entity with a malformed id on both Context Brok Should Be Empty ${response_query.json()} *** Keywords *** -Setup Initial Context Source Registration And Start Context Source Mock Server +Setup Registration And Start Context Source Mock Server ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${context_source_registration_id} ${registration_payload}= Prepare Context Source Registration From File diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 90519e90e..019d1a0a7 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -42,12 +42,10 @@ class InitialSetup: 'Create Initial hosted @context': InitialSetup.create_hosted_context(), 'Create Initial @context condition from an external server': InitialSetup.create_from_external_server(), 'Delete core context and reload it': InitialSetup.delete_core_context(), - 'Setup Entities And Registration': InitialSetup.init_entities_and_csr(), - 'Setup Entity Id And Registration': InitialSetup.init_eid_and_csr(), - 'Setup Entity On Remote And Registration': InitialSetup.init_remote_entity_and_csr(), - 'Setup Entity On Local And Registration': InitialSetup.init_local_entity_and_csr(), - 'Create Entities With Different Payloads And Registration': InitialSetup.init_diff_entities_and_csr(), - 'Create Initial Cached @context from entity': InitialSetup.init_cached_conctext() + 'Setup Entity Id And Registration And Start Context Source Mock Server': InitialSetup.init_eid_and_csr_and_ms(), + 'Setup Registration And Start Context Source Mock Server': InitialSetup.init_csr_and_ms(), + 'Create Entity And Registration On The Context Broker And Start Context Source Mock Server': InitialSetup.init_local_entity_and_csr_and_ms(), + 'Create Initial Cached @context from entity': InitialSetup.init_cached_context() } self.folder_test_suites = dirname(dirname(dirname(__file__))) @@ -225,7 +223,7 @@ class InitialSetup: return data @staticmethod - def init_cached_conctext(): + def init_cached_context(): data = '''with { the SUT containing a cached context from creating an entity. }''' @@ -274,44 +272,30 @@ class InitialSetup: return data @staticmethod - def init_entities_and_csr() -> str: - data = '''with { - the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on both the Context Broker and Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing a Context Source Registration - with id equal to ${registration_id} - and payload set to ${registration_payload_file_path} -}''' - return data - - @staticmethod - def init_eid_and_csr() -> str: + def init_eid_and_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and the SUT containing an initial Entity id set to ${entity_id} and the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data @staticmethod - def init_remote_entity_and_csr() -> str: + def init_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on the Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing a Context Source Registration + the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data - + @staticmethod - def init_local_entity_and_csr() -> str: + def init_local_entity_and_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and the SUT containing an initial Entity ${entity} on the Context Broker @@ -320,25 +304,10 @@ class InitialSetup: and the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data - @staticmethod - def init_diff_entities_and_csr() -> str: - data = '''with { - the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on the Context Broker - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing an initial Entity ${entity} on the Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename2} - and the SUT containing a Context Source Registration - with id equal to ${registration_id} - and payload set to ${registration_payload_file_path} -}''' - return data - def get_property_values(self, root_folder: str, property_name: str) -> [str, str]: robot_files_without_setup = list() robot_files_with_setup = list() -- GitLab From 7b7b6011e9e90313055dd5329784caf16aa10e48 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 20 May 2025 10:45:59 +0200 Subject: [PATCH 11/34] added filtering in documentation generation --- doc/statisticsDocumentationData.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/statisticsDocumentationData.py b/doc/statisticsDocumentationData.py index 65e09e8d9..3786cd9c2 100644 --- a/doc/statisticsDocumentationData.py +++ b/doc/statisticsDocumentationData.py @@ -16,7 +16,10 @@ if __name__ == "__main__": BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" fullpath = basedir + "/TP/NGSI-LD" + excluded_dirs = [''] for root, dirs, files in walk(fullpath): + if root == fullpath: + dirs[:] = [d for d in dirs if d not in excluded_dirs] for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 @@ -40,6 +43,8 @@ if __name__ == "__main__": # establish the right configuration if json_of_test_case["robotpath"].startswith("ContextSource"): json_of_test_case["config_id"] = "CF_05" + elif 'cf_06' in json_of_test_case["test_cases"][0]["tags"]: + json_of_test_case["config_id"] = "CF_06" else: json_of_test_case["config_id"] = "CF_01" @@ -63,7 +68,6 @@ if __name__ == "__main__": print("NO PERMUTATIONS in TESTCASE??? " + json_of_test_case["tp_id"]) exit(1) testcases.append(json_of_test_case) - print() print() print() -- GitLab From 3fd98c568d24ae4d1addebb8294a6cfbc508a6a2 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 20 May 2025 10:46:29 +0200 Subject: [PATCH 12/34] added auxiliary registration mode test cases --- .../Entity/QueryEntities/D011_01_aux.robot | 61 +++++++++++++++++++ .../Entity/RetrieveEntity/D010_01_aux.robot | 61 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot new file mode 100644 index 000000000..400bb4839 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Verify that when an auxiliary registration exists on a Context Broker and an entity with the same ID exists both locally in the Context Broker and remotely in the Context Source with different attributes, a query request to the Context Broker is correctly forwarded to the Context Source, and the response includes the local entity enriched with additional, non-conflicting attributes from the Context Source + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +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 *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${entity_payload_filename2} vehicle-simple-attributes-second.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${fragment_filename} vehicle-brandname-fragment.json +${expected_attribute} brandName + +*** Test Cases *** +D011_01_aux Query entities that exists on both the Context Source and the Context Broker from the Context Broker + [Documentation] Check that if one queries the Context Broker for type, entities get merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} + ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing an Attribute set to ${expected_attribute} ${response.json()[0]} ${entity_fragment} + Should Have Value In Json ${response.json()[0]} $.isParked + Should Have Value In Json ${response.json()[0]} $.isParked2 + + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename2} ${entity_id} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot new file mode 100644 index 000000000..0d9743e64 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Verify that when an auxiliary registration exists on a Context Broker and an entity with the same ID exists both locally in the Context Broker and remotely in the Context Source with different attributes, a retrieval request to the Context Broker is correctly forwarded to the Context Source, and the response includes the local entity enriched with additional, non-conflicting attributes from the Context Source + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +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 *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${entity_payload_filename2} vehicle-simple-attributes-second.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${fragment_filename} vehicle-brandname-fragment.json +${expected_attribute} brandName + +*** Test Cases *** +D010_01_aux Retrieve entity that exists on both the Context Source and the Context Broker from the Context Broker + [Documentation] Check that if one retrieves entity living on on both the Context Broker and a Context Source, entities get merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + Set Stub Reply GET /ngsi-ld/v1/entities/${entity_id} 200 ${entity_body} + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing an Attribute set to ${expected_attribute} ${response.json()} ${entity_fragment} + Should Have Value In Json ${response.json()} $.isParked + Should Have Value In Json ${response.json()} $.isParked2 + + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename2} ${entity_id} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From e4f02ec03e6e8678bea4343967f00681457ad318 Mon Sep 17 00:00:00 2001 From: Marco Cavalli Date: Tue, 20 May 2025 16:25:09 +0200 Subject: [PATCH 13/34] refactor statisticsDocumentationData.py for improved readability and consistency --- doc/statisticsDocumentationData.py | 94 +++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 27 deletions(-) diff --git a/doc/statisticsDocumentationData.py b/doc/statisticsDocumentationData.py index 3786cd9c2..1e680c45d 100644 --- a/doc/statisticsDocumentationData.py +++ b/doc/statisticsDocumentationData.py @@ -13,28 +13,39 @@ if __name__ == "__main__": number_of_all_testcases = 0 number_of_successes = 0 ROBOT_FILE_EXTENSION = ".robot" - BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" + BASE_URL_OF_FORGE = ( + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" + ) fullpath = basedir + "/TP/NGSI-LD" - excluded_dirs = [''] + excluded_dirs = [""] for root, dirs, files in walk(fullpath): if root == fullpath: dirs[:] = [d for d in dirs if d not in excluded_dirs] for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 - name_of_test_case = filename[:-len(ROBOT_FILE_EXTENSION)] + name_of_test_case = filename[: -len(ROBOT_FILE_EXTENSION)] json_of_test_case = create_json_of_robotfile(name_of_test_case, True) statistics[name_of_test_case] = dict() - strippedpath = root[len(fullpath)+1:] + strippedpath = root[len(fullpath) + 1 :] statistics[name_of_test_case]["path"] = strippedpath - if "error_while_parsing" in json_of_test_case and json_of_test_case["error_while_parsing"]: + if ( + "error_while_parsing" in json_of_test_case + and json_of_test_case["error_while_parsing"] + ): statistics[name_of_test_case]["failed"] = True number_of_failures += 1 # we create a dummy entry in the "sub" test_cases, which has a "permutation_tp_id" equal to the # robotfile. We do not forget to add a trailing slash that will be removed later, and a tail _XX # which will allow matching from the googlesheet? - json_of_test_case["test_cases"] = [{"permutation_tp_id": "/"+json_of_test_case["robotfile"]+"_XX"}] + json_of_test_case["test_cases"] = [ + { + "permutation_tp_id": "/" + + json_of_test_case["robotfile"] + + "_XX" + } + ] else: statistics[name_of_test_case]["failed"] = False number_of_successes += 1 @@ -43,14 +54,17 @@ if __name__ == "__main__": # establish the right configuration if json_of_test_case["robotpath"].startswith("ContextSource"): json_of_test_case["config_id"] = "CF_05" - elif 'cf_06' in json_of_test_case["test_cases"][0]["tags"]: + elif "cf_06" in json_of_test_case["test_cases"][0]["tags"]: json_of_test_case["config_id"] = "CF_06" else: json_of_test_case["config_id"] = "CF_01" # upgrade the version and add the reference in square brackets - json_of_test_case["reference"] = ( - re.sub(r"V1.3.1 \[\]", "version 1.5.1 [1]", json_of_test_case["reference"])) + json_of_test_case["reference"] = re.sub( + r"V1\.[3-6]\.1 \[\]", + "V1.6.1 [1]", + json_of_test_case["reference"], + ) # now for each permutation inside this test case, create the permutation's correct parent_release if "test_cases" in json_of_test_case: @@ -59,13 +73,18 @@ if __name__ == "__main__": # default parent release parent_release = "v1.3.1" for tag in permutation_body["tags"]: - if tag.startswith('since_'): - parts = tag.split('_') + if tag.startswith("since_"): + parts = tag.split("_") # the suffix parent_release = parts[-1] - permutation_body["permutation_parent_release"] = parent_release + permutation_body["permutation_parent_release"] = ( + parent_release + ) else: - print("NO PERMUTATIONS in TESTCASE??? " + json_of_test_case["tp_id"]) + print( + "NO PERMUTATIONS in TESTCASE??? " + + json_of_test_case["tp_id"] + ) exit(1) testcases.append(json_of_test_case) print() @@ -74,14 +93,16 @@ if __name__ == "__main__": print("THE FOLLOWING TESTCASES FAILED PARSING:") for testcasename, testcaseresult in statistics.items(): if testcaseresult["failed"]: - print(testcasename+" "+testcaseresult["path"]) - - print(f"Out of {number_of_all_testcases} testcases, {number_of_failures} of them failed to be correctly parsed.") + print(testcasename + " " + testcaseresult["path"]) + + print( + f"Out of {number_of_all_testcases} testcases, {number_of_failures} of them failed to be correctly parsed." + ) testcases_file = join(basedir, "doc", "results", "testcases.json") - with open(testcases_file, 'w') as fp: + with open(testcases_file, "w") as fp: json.dump(obj=testcases, indent=2, fp=fp) - + # determine the structure/schema of a successfully parsed testcase permutation_template = {} for testcase in testcases: @@ -107,9 +128,13 @@ if __name__ == "__main__": # everything that is a permutation_body inside the "sub" test_cases, # shall rise on its own existenz and be joined with its permutation_metadata for permutation_body in testcase["test_cases"]: - permutation_body_template = {} # new object, not changing permutation_body + permutation_body_template = ( + {} + ) # new object, not changing permutation_body if "permutation_tp_id" in permutation_body: - permutation_body_template["stripped_permutation_tp_id"] = "UNKNOWN" + permutation_body_template["stripped_permutation_tp_id"] = ( + "UNKNOWN" + ) permutation_body_template["robotlink"] = "UNKNOWN" for key, value in permutation_body.items(): if type(key) is str: @@ -126,7 +151,10 @@ if __name__ == "__main__": print("UNKNOWN BODY type") exit(1) # we use the unpacking python operator ** that strips the container dict from both - permutation_template = {**permutation_metadata_template, **permutation_body_template} + permutation_template = { + **permutation_metadata_template, + **permutation_body_template, + } else: print("NO PERMUTATION TP ID") exit(1) @@ -135,7 +163,7 @@ if __name__ == "__main__": exit(1) if permutation_template != {}: break - + print() print("Typical template:") print(permutation_template) @@ -152,8 +180,13 @@ if __name__ == "__main__": permutation_metadata[key] = value # start creating HTML link to robot file in repo - fullurl = (BASE_URL_OF_FORGE + permutation_metadata["robotpath"] + - "/" + permutation_metadata["robotfile"] + ROBOT_FILE_EXTENSION) + fullurl = ( + BASE_URL_OF_FORGE + + permutation_metadata["robotpath"] + + "/" + + permutation_metadata["robotfile"] + + ROBOT_FILE_EXTENSION + ) if "test_cases" in testcase: # everything that is a permutation_body inside the "sub" test_cases, @@ -168,11 +201,18 @@ if __name__ == "__main__": # print("::: "+ptpid) # strip from beginning up to including the last "/" - permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:] + permutation_body["stripped_permutation_tp_id"] = ptpid[ + ptpid.rindex("/") + 1 : + ] # use the stripped_permutation_tp_id as text of the link permutation_body["robotlink"] = ( - "" + permutation_body["stripped_permutation_tp_id"] + "") + '' + + permutation_body["stripped_permutation_tp_id"] + + "" + ) # So basically we append to the permutations a new dict that is the | union merge of the # items of the template merged with the items of the concatenation of {**permutation_metadata, @@ -199,5 +239,5 @@ if __name__ == "__main__": exit(1) permutations_file = join(basedir, "doc", "results", "permutations.json") - with open(permutations_file, 'w') as fp: + with open(permutations_file, "w") as fp: json.dump(obj=permutations, indent=2, fp=fp) -- GitLab From 21b65d1c61f8f1aacbb6d3dd29820f605eb7c033 Mon Sep 17 00:00:00 2001 From: Marco Cavalli Date: Tue, 20 May 2025 17:04:05 +0200 Subject: [PATCH 14/34] refactor generateDocumentationData.py for improved readability and structure --- doc/generateDocumentationData.py | 40 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/generateDocumentationData.py b/doc/generateDocumentationData.py index b4451d382..f82decb69 100644 --- a/doc/generateDocumentationData.py +++ b/doc/generateDocumentationData.py @@ -5,16 +5,19 @@ from os.path import dirname, exists from os import makedirs, walk -def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: bool=False): +def create_json_of_robotfile( + robot_file_to_be_processed: str, computestatistics: bool = False +): # TODO: ApiUtils.resource -> 'Delete Context Source Registration Subscription' added 'url=' as parameter - folder_test_suites = dirname(dirname(__file__)).replace('\\', "/") - folder_result_path = f'{folder_test_suites}/doc/results' - result_file = f'{folder_result_path}/{robot_file_to_be_processed}.json' - robot_path_to_be_processed, robot_file = find_robot_file(basedir=folder_test_suites, - filename=robot_file_to_be_processed) + folder_test_suites = dirname(dirname(__file__)).replace("\\", "/") + folder_result_path = f"{folder_test_suites}/doc/results" + result_file = f"{folder_result_path}/{robot_file_to_be_processed}.json" + robot_path_to_be_processed, robot_file = find_robot_file( + basedir=folder_test_suites, filename=robot_file_to_be_processed + ) if robot_path_to_be_processed is None and robot_file is None: - print(f'No robot file found with name: {robot_file_to_be_processed}') + print(f"No robot file found with name: {robot_file_to_be_processed}") exit(1) # Check that the folder '/results' exists and if not, create it @@ -33,7 +36,7 @@ def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: info["error_while_parsing"] = True info["error_while_autogenerating"] = str(e) info["robotfile"] = robot_file_to_be_processed - if(robot_path_to_be_processed.startswith("/")): + if robot_path_to_be_processed.startswith("/"): robot_path_to_be_processed = robot_path_to_be_processed[1:] info["robotpath"] = robot_path_to_be_processed else: @@ -41,17 +44,17 @@ def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: data.parse_robot() info = data.get_info() - with open(result_file, 'w') as fp: + with open(result_file, "w") as fp: dump(obj=info, indent=2, fp=fp) return info def find_robot_file(basedir: str, filename: str): - filename = f'{filename}.robot' + filename = f"{filename}.robot" for root, dirs, files in walk(basedir): if filename in files: - return root.replace(f'{basedir}/TP/NGSI-LD', ''), f'{root}/{filename}' + return root.replace(f"{basedir}/TP/NGSI-LD", ""), f"{root}/{filename}" return None, None @@ -59,7 +62,18 @@ def find_robot_file(basedir: str, filename: str): if __name__ == "__main__": # Call with the folder below /TP/NGSI-LD which contains the robot file with name args[0] args = argv[1:] - robot_file_tbp = args[0] - resulting_json = create_json_of_robotfile(robot_file_tbp) + if len(args) == 0: + tp_root_name = dirname(dirname(__file__)).replace("\\", "/") + robot_file_tbp = f"{tp_root_name}/TP/NGSI-LD/" + robot_file_tbp = robot_file_tbp.replace("\\", "/") + for root, dirs, files in walk(robot_file_tbp): + for file in files: + if file.endswith(".robot"): + filename = file.replace(".robot", "") + print(f"Generating json for {filename}") + create_json_of_robotfile(filename, computestatistics=True) + else: + robot_file_tbp = args[0] + resulting_json = create_json_of_robotfile(robot_file_tbp) print("\nCorrectly exiting") -- GitLab From 172b17ef66b01119de6830a02a9b3e76e186cf15 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 7 May 2025 11:45:44 +0200 Subject: [PATCH 15/34] fix: doc generation failing on some Batch operations --- .../BatchEntities/MergeBatchOfEntities/057_03.robot | 13 +++++++------ .../UpdateBatchOfEntities/005_04.robot | 13 +++++++------ .../UpsertBatchOfEntities/004_06.robot | 13 +++++++------ doc/analysis/checks.py | 4 ++-- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot index c710de27c..fad99abc2 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot @@ -22,13 +22,14 @@ Batch Merge Entity With Invalid Request Scenarios Check Response Status Code ${expected_status_code} ${response.status_code} IF '${expected_status_code}'=='400' Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${problem_type} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + ... response_body=${response.json()} + ... type=${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element + ... response_body=${response.json()} ELSE Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]['error']} - ... ${problem_type} + ... response_body=${response.json()['errors'][0]['error']} + ... type=${problem_type} Check Response Body Containing ProblemDetails Element Containing Title Element - ... ${response.json()['errors'][0]['error']} + ... response_body=${response.json()['errors'][0]['error']} END diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot index d37bed155..cf16eb7c8 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -24,13 +24,14 @@ Batch Update Entity With Invalid Request Scenarios Check Response Status Code ${expected_status_code} ${response.status_code} IF '${expected_status_code}'=='400' Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${problem_type} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + ... response_body=${response.json()} + ... type=${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element + ... response_body=${response.json()} ELSE Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]['error']} - ... ${problem_type} + ... response_body=${response.json()['errors'][0]['error']} + ... type=${problem_type} Check Response Body Containing ProblemDetails Element Containing Title Element - ... ${response.json()['errors'][0]['error']} + ... response_body=${response.json()['errors'][0]['error']} END diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot index 19603ad2c..62173dde8 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -24,13 +24,14 @@ Batch Upsert Entity With Invalid Request Scenarios Check Response Status Code ${expected_status_code} ${response.status_code} IF '${expected_status_code}'=='400' Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${problem_type} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + ... response_body=${response.json()} + ... type=${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element + ... response_body=${response.json()} ELSE Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]['error']} - ... ${problem_type} + ... response_body=${response.json()['errors'][0]['error']} + ... type=${problem_type} Check Response Body Containing ProblemDetails Element Containing Title Element - ... ${response.json()['errors'][0]['error']} + ... response_body=${response.json()['errors'][0]['error']} END diff --git a/doc/analysis/checks.py b/doc/analysis/checks.py index 792718ffa..03a01ec15 100644 --- a/doc/analysis/checks.py +++ b/doc/analysis/checks.py @@ -166,8 +166,8 @@ class Checks: 'position': [0, 1] }, 'Check Response Body Containing ProblemDetails Element Containing Type Element set to': { - 'params': ['type'], - 'position': [1] + 'params': ['response_body', 'type'], + 'position': [0, 1] }, 'Check Response Body Containing ProblemDetails Element': { 'params': ['problem_type'], -- GitLab From 14b6fef6f107206d67f002e00ca805912735a6f7 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 7 May 2025 11:52:37 +0200 Subject: [PATCH 16/34] fix: misc doc generation errors --- .../Entity/RetrieveEntity/018_04.robot | 4 ++-- .../Provision/AddContext/050_04.robot | 21 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot index 2a68aebe8..2d54419c2 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot @@ -6,7 +6,7 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption. Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Test Setup Create Entity +Test Setup Create Initial Entity Test Teardown Delete Created Entity @@ -35,7 +35,7 @@ ${options_parameter}= keyValues *** Keywords *** -Create Entity +Create Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} Set Test Variable ${entity_id} ${create_response}= Create Entity Selecting Content Type diff --git a/TP/NGSI-LD/jsonldContext/Provision/AddContext/050_04.robot b/TP/NGSI-LD/jsonldContext/Provision/AddContext/050_04.robot index 7e6f300c1..b6f2132c8 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/AddContext/050_04.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/AddContext/050_04.robot @@ -1,22 +1,22 @@ *** Settings *** Documentation Check that one can add a hosted @context with list of URIs and each of them are cached @coxtexts -Variables ${EXECDIR}/resources/variables.py + +Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils/jsonldContext.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource - Test Teardown Delete Initial @context *** Variables *** -${filename_list}= @context-cached-valid.json -${entity_filename}= building-simple-attributes.json -${reason_201}= Created -${reason_204}= No Content +${filename_list}= @context-cached-valid.json +${entity_filename}= building-simple-attributes.json +${reason_201}= Created +${reason_204}= No Content ${building_id_prefix}= urn:ngsi-ld:Building: -${content_type}= application/json +${content_type}= application/json *** Test Cases *** @@ -40,14 +40,13 @@ ${content_type}= application/json ${response_serve}= Serve a @context ${uri} true Check Response Kind set to ${response_serve.json()} Hosted ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${response}= Create Entity Selecting Content Type + Create Entity Selecting Content Type ... ${entity_filename} ... ${entity_id} ... ${content_type} ... ${url}${uri} - - - ${response}= Delete Entity By Id ${entity_id} + + Delete Entity By Id ${entity_id} # Need to check that each of the URIs are Cached @contexts Check Cached @Contexts ${filename_list} -- GitLab From 36fff913bfdfb1e48d502fd2e22f0b9a0c5805f0 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Tue, 20 May 2025 14:52:20 +0200 Subject: [PATCH 17/34] chore: apply Robotidy to all Robot files --- .../Entity/QueryEntities/019_02_05.robot | 23 ++++++------ .../Entity/QueryEntities/019_05.robot | 19 +++++----- .../Entity/QueryEntities/D011_01_01_inc.robot | 8 +++-- .../Entity/QueryEntities/D011_01_02_inc.robot | 7 ++-- .../Entity/QueryEntities/D011_01_03_inc.robot | 7 ++-- .../Entity/QueryEntities/D011_01_04_inc.robot | 6 ++-- .../Entity/QueryEntities/D011_01_05_inc.robot | 14 ++++---- .../Entity/QueryEntities/D011_02_inc.robot | 8 +++-- .../Entity/RetrieveEntity/D010_01_inc.robot | 7 ++-- .../Entity/RetrieveEntity/D010_02_inc.robot | 7 ++-- .../Entities/CreateEntity/D001_01_inc.robot | 2 +- .../Entities/CreateEntity/D001_02_inc.robot | 17 ++++----- .../CreateEntity/D001_03_01_inc.robot | 9 ++--- .../CreateEntity/D001_03_02_inc.robot | 6 ++-- .../CreateEntity/D001_03_03_inc.robot | 7 ++-- .../Entities/DeleteEntity/D002_01_inc.robot | 6 ++-- .../DeleteEntity/D002_02_01_inc.robot | 5 +-- .../DeleteEntity/D002_02_02_inc.robot | 8 +++-- .../UpdateEntityAttributes/D004_01_inc.robot | 5 +-- .../Consumption/ListContexts/052_01.robot | 2 +- .../Consumption/ListContexts/052_02.robot | 1 - .../Consumption/ListContexts/052_03.robot | 1 - .../Consumption/ListContexts/052_05.robot | 8 ++--- .../Consumption/ListContexts/052_06.robot | 13 ++++--- .../Consumption/ListContexts/052_07.robot | 15 ++++---- .../Consumption/ServeContext/053_03.robot | 8 ++--- .../Consumption/ServeContext/053_05.robot | 4 +-- .../Consumption/ServeContext/053_06.robot | 2 +- .../Consumption/ServeContext/053_07.robot | 1 - .../Consumption/ServeContext/053_08.robot | 4 +-- .../Provision/DeleteContext/051_03.robot | 14 ++++---- .../Provision/DeleteContext/051_05.robot | 2 +- .../Provision/DeleteContext/051_06.robot | 2 -- .../ContextInformationConsumption.resource | 9 +++-- resources/AssertionUtils.resource | 36 +++++++++++-------- 35 files changed, 165 insertions(+), 128 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot index 4cb62831e..15295a0b3 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot @@ -11,15 +11,15 @@ Suite Teardown Delete Entities *** Variables *** -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: -${vehicle_filename}= vehicle-simple-attributes.jsonld -${parking_filename}= parking-simple-attributes.jsonld -${expectation_filename_alt2}= vehicle-parking-019-02-05.alternative2.geojson -${expectation_filename_alt1}= vehicle-parking-019-02-05.alternative.geojson -${expectation_filename}= vehicle-parking-019-02-05.geojson -${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle -${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: +${vehicle_filename}= vehicle-simple-attributes.jsonld +${parking_filename}= parking-simple-attributes.jsonld +${expectation_filename_alt2}= vehicle-parking-019-02-05.alternative2.geojson +${expectation_filename_alt1}= vehicle-parking-019-02-05.alternative.geojson +${expectation_filename}= vehicle-parking-019-02-05.geojson +${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle +${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking *** Test Cases *** @@ -34,7 +34,10 @@ ${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking ... accept=${CONTENT_TYPE_GEOJSON} ... context=${ngsild_test_suite_context} Check Response Status Code 200 ${response.status_code} - ${alternatives}= Create List ${expectation_filename} ${expectation_filename_alt1} ${expectation_filename_alt2} + ${alternatives}= Create List + ... ${expectation_filename} + ... ${expectation_filename_alt1} + ... ${expectation_filename_alt2} Check Body With Alternatives ... response_body=${response.json()} ... alternatives=${alternatives} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot index 80a94e3dc..03bcf9d1c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot @@ -11,12 +11,12 @@ Suite Teardown Delete Entities *** Variables *** -${building_id_prefix}= urn:ngsi-ld:Building: -${filename}= building-location-attribute.jsonld -${expectation_filename}= two-buildings-location-attribute-normalized-019-05.geojson -${expectation_filename_alt1}= two-buildings-location-attribute-normalized-019-05.alternative.geojson -${expectation_filename_alt2}= two-buildings-location-attribute-normalized-019-05.alternative2.geojson -${entity_type}= https://ngsi-ld-test-suite/context#Building +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute.jsonld +${expectation_filename}= two-buildings-location-attribute-normalized-019-05.geojson +${expectation_filename_alt1}= two-buildings-location-attribute-normalized-019-05.alternative.geojson +${expectation_filename_alt2}= two-buildings-location-attribute-normalized-019-05.alternative2.geojson +${entity_type}= https://ngsi-ld-test-suite/context#Building *** Test Cases *** @@ -32,13 +32,16 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building ... accept=${CONTENT_TYPE_GEOJSON} ... context=${ngsild_test_suite_context} - Check Response Status Code 200 ${response.status_code} - ${alternatives}= Create List ${expectation_filename} ${expectation_filename_alt1} ${expectation_filename_alt2} + ${alternatives}= Create List + ... ${expectation_filename} + ... ${expectation_filename_alt1} + ... ${expectation_filename_alt2} Check Body With Alternatives ... response_body=${response.json()} ... alternatives=${alternatives} + *** Keywords *** Create Initial Entities ${first_entity_id}= Catenate ${building_id_prefix}019-05-01 diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot index 350e5fbd0..fe302ca3c 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D011_01_01_inc Query The Context Broker With Type [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets returned @@ -31,6 +32,7 @@ D011_01_01_inc Query The Context Broker With Type @{entities_id}= Create List ${entity_id} Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -38,7 +40,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} @@ -48,4 +50,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot index 3ab077642..699a6f1f5 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D011_01_02_inc Query The Context Broker With Type And Missing Attribute [Documentation] Check that if one queries for type and an attribute that is missing, no entity gets returned @@ -30,7 +31,7 @@ D011_01_02_inc Query The Context Broker With Type And Missing Attribute Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} - + *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -38,7 +39,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot index b4677e0dd..533c80622 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename2} vehicle-simple-attributes-second.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-entities.jsonld + *** Test Cases *** D011_01_03_inc Query The Context Broker With Type and Attribute [Documentation] Check that if one queries for attribute present in an entity on a Context Source, only that entity gets returned @@ -30,7 +31,7 @@ D011_01_03_inc Query The Context Broker With Type and Attribute Check Response Status Code 200 ${response.status_code} @{entities_id}= Create List ${second_entity_id} Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} - + *** Keywords *** Create Entity And Registration On The Context Broker And Start Context Source Mock Server @@ -44,7 +45,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response2}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot index 5b65606ea..f08c029c7 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename2} vehicle-simple-attributes-second.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D011_01_04_inc Query The Context Broker With Type and Attribute In Neither [Documentation] Check that if one queries for attribute present in neither of the entities, neither of them gets returned @@ -30,6 +31,7 @@ D011_01_04_inc Query The Context Broker With Type and Attribute In Neither Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} + *** Keywords *** Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${first_entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -42,7 +44,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response2}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot index 082ac614f..c072bcc77 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, entities with same id on the Context Broker and on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker, entities with same id on the Context Broker and on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename2} vehicle-simple-different-attributes.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D011_01_05_inc Query The Context Broker With Type [Documentation] Check that entities on the Context Broker and Context Source with the same id get merged and returned as one entity @@ -32,11 +33,10 @@ D011_01_05_inc Query The Context Broker With Type ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} Check Response Status Code 200 ${response.status_code} Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} - Should Have Value In Json ${response.json()[0]} $.brandName - Should Have Value In Json ${response.json()[0]} $.speed - Should Have Value In Json ${response.json()[0]} $.isParked - Should Have Value In Json ${response.json()[0]} $.isParked2 - + Should Have Value In Json ${response.json()[0]} $.brandName + Should Have Value In Json ${response.json()[0]} $.speed + Should Have Value In Json ${response.json()[0]} $.isParked + Should Have Value In Json ${response.json()[0]} $.isParked2 *** Keywords *** @@ -49,7 +49,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot index a7ab42c9f..b9bb9706d 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker with local flag entity not found error is raised +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker with local flag entity not found error is raised Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D011_02_inc Query The Context Broker With Local Flag [Documentation] Check that if one queries with the local flag, no entity from Context Source gets returned @@ -29,6 +30,7 @@ D011_02_inc Query The Context Broker With Local Flag Check Response Status Code 200 ${response.status_code} Should Be Empty ${response.json()} + *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -36,7 +38,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} @@ -48,4 +50,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Stop Context Source Mock Server - \ No newline at end of file + diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot index 37cf39262..d4932d876 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker the request gets forwarded to the Context Source correctly +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker the request gets forwarded to the Context Source correctly Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -28,6 +28,7 @@ D010_01_inc Retrieve entity on a Context Source from the Context Broker Check Response Status Code 200 ${response.status_code} + *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -35,7 +36,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} @@ -46,4 +47,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot index fd7850e30..164ad1a7e 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker with local flag entity not found error is raised +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker with local flag entity not found error is raised Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -17,6 +17,7 @@ ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + *** Test Cases *** D010_02_inc Retrieve entity on a Context Source from the Context Broker with local flag [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker with local flag, entity not found error is raised @@ -34,7 +35,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} @@ -45,4 +46,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot index 9c903c00c..9c387a4a4 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot @@ -56,4 +56,4 @@ Setup Entity Id And Registration And Start Context Source Mock Server Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index a7acf268d..95c8dd7be 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source +Documentation Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -14,11 +14,12 @@ Test Teardown Delete Created Registration And Stop Context Source Mock Serv *** Variables *** -${entity_id} InvalidUriExample -${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld -${registration_id_prefix} urn:ngsi-ld:Registration: -${context_source_registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld +${entity_id} InvalidUriExample +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${context_source_registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D001_02_inc Request to create an entity with a malformed id on both Context Broker and Context Source @@ -36,7 +37,7 @@ D001_02_inc Request to create an entity with a malformed id on both Context Brok Setup Initial Context Source Registration And Start Context Source Mock Server ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${context_source_registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${context_source_registration_id} ... ${context_source_registration_payload_file_path} ${response1}= Create Context Source Registration With Return ${registration_payload} @@ -45,4 +46,4 @@ Setup Initial Context Source Registration And Start Context Source Mock Server Delete Created Registration And Stop Context Source Mock Server Delete Context Source Registration ${context_source_registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot index 524155a2a..05f5297f8 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an entity and an inclusive registration on a Context Broker, one is able to create that entity on a Context Source from the Context Broker but gets an error for the Context Broker +Documentation Verify that, when one has an entity and an inclusive registration on a Context Broker, one is able to create that entity on a Context Source from the Context Broker but gets an error for the Context Broker Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D001_03_01_inc Create entity already existing locally on a Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists locally, this raises an error on the Context Broker but is created correctly on the Context Source @@ -26,7 +27,7 @@ D001_03_01_inc Create entity already existing locally on a Context Source Set Stub Reply POST /ngsi-ld/v1/entities 201 ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 207 ${response.status_code} - + Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][0]['error']} ${length}= Get Length ${response.json()['errors']} Should Be Equal As Integers ${length} 1 @@ -46,7 +47,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} @@ -57,4 +58,4 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot index e7ab3e37a..330000fd3 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D001_03_02_inc Create entity already existing on both Context Broker and Context Source [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists both locally and remotely, this raises an error on both Context Broker and Context Source @@ -30,6 +31,7 @@ D001_03_02_inc Create entity already existing on both Context Broker and Context Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][0]['error']} Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][1]['error']} + *** Keywords *** Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -39,7 +41,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} @@ -50,4 +52,4 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot index 18397409f..623df13a6 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_03_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an entity on a Context Source and an inclusive registration on a Context Broker, one is not able to create that entity on the Context Source from the Context Broker but one is able to create it on the Context Broker +Documentation Verify that, when one has an entity on a Context Source and an inclusive registration on a Context Broker, one is not able to create that entity on the Context Source from the Context Broker but one is able to create it on the Context Broker Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D001_03_03_inc Create entity already existing remotely on the Context Broker [Documentation] Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists remotely, this raises an error on the Context Source, but it works just fine on the Context Broker @@ -40,7 +41,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} @@ -51,4 +52,4 @@ Setup Registration And Start Context Source Mock Server Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot index d77ea2b41..618f67cab 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D002_01_inc Delete Entities On Both Context Broker and Context Source [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source @@ -32,6 +33,7 @@ D002_01_inc Delete Entities On Both Context Broker and Context Source ${response_retrieve}= Retrieve Entity by Id ${entity_id} local=true Check Response Status Code 404 ${response_retrieve.status_code} + *** Keywords *** Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -41,7 +43,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot index 02df311b6..9ce0ac232 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D002_02_01_inc Delete Entity On The Context Broker [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure @@ -40,7 +41,7 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot index 3f5c7fd93..916a11a3a 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure +Documentation Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -19,6 +19,7 @@ ${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + *** Test Cases *** D002_02_02_inc Delete Entity On a Context Source [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure @@ -31,6 +32,7 @@ D002_02_02_inc Delete Entity On a Context Source ${length}= Get Length ${response.json()['errors']} Should Be Equal As Integers ${length} 1 + *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} @@ -38,7 +40,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File + ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} ... entity_id=${entity_id} @@ -48,4 +50,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot index c35a0dbcc..873fcbb1c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an inclusive registration on a Context Broker with redirectionOps, one is able to update entities on a Context Source +Documentation Verify that, when one has an inclusive registration on a Context Broker with redirectionOps, one is able to update entities on a Context Source Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -20,6 +20,7 @@ ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld ${fragment_filename} vehicle-brandname-complete-fragment.jsonld + *** Test Cases *** D004_01_inc Query The Context Broker With Type [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too @@ -61,4 +62,4 @@ Setup Registration And Start Context Source Mock Server Delete Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} - Stop Context Source Mock Server \ No newline at end of file + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_01.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_01.robot index 2cb2cb0a9..f4623001f 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_01.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_01.robot @@ -45,7 +45,7 @@ List @contexts with no previous created @context [Documentation] Check that one can list @contexts [Arguments] ${details} ${kind} ${response}= List @contexts ${details} ${kind} - ${empty_array}= Create List + ${empty_array}= Create List Check Response Status Code 200 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_200} Check Context Response Body Containing a list of identifiers diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_02.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_02.robot index 30d4212eb..4bfc1a96e 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_02.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_02.robot @@ -31,7 +31,6 @@ ${reason_204}= No Content false Hosted - *** Keywords *** Create Initial @context ${response}= Add a new @context ${first_filename} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_03.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_03.robot index 1e722849d..99f322b6f 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_03.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_03.robot @@ -33,7 +33,6 @@ ${reason_204}= No Content false Hosted - *** Keywords *** Create Initial set of @contexts ${response}= Add a new @context ${first_filename} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_05.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_05.robot index 34e9c3385..26001b80c 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_05.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_05.robot @@ -25,11 +25,11 @@ ${reason_204}= No Content 052_05_02 List @contexts with details set to true and kind set to hosted and with previously several add @contexts [Tags] ctx-list 5_13_3 since_v1.5.1 true Hosted -#move to new tests this doesn't work like this. cached need to run differently -#052_05_03 List @contexts with details set to true and kind set to cached abd with previously several add @contexts +# move to new tests this doesn't work like this. cached need to run differently +# 052_05_03 List @contexts with details set to true and kind set to cached abd with previously several add @contexts # [Tags] ctx-list 5_13_3 since_v1.5.1 # true Cached -#052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts +# 052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts # [Tags] ctx-list 5_13_3 since_v1.5.1 # true ImplicitlyCreated @@ -50,7 +50,7 @@ Create Initial set of @contexts Check Response Status Code 201 ${response.status_code} ${third_uri}= Fetch Id From Response Location Header ${response.headers} Set Suite Variable ${third_uri} - + @{uris}= Create List Append To List ${uris} ${first_uri} Append To List ${uris} ${second_uri} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_06.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_06.robot index 4a5431c62..0c4e0db5c 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_06.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_06.robot @@ -52,9 +52,13 @@ List @contexts with no previous created @context Check Response Status Code 200 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_200} - + IF '${kind}' == 'Hosted' - ${entryFound}= Run Keyword And Return Status Check Context Response Body Containing a list of identifiers ${response.json()} ${list_contexts} ${kind} + ${entryFound}= Run Keyword And Return Status + ... Check Context Response Body Containing a list of identifiers + ... ${response.json()} + ... ${list_contexts} + ... ${kind} Should Not Be True ${entryFound} ELSE IF '${kind}' == 'ImplicitlyCreated' ${tmp}= Create List ${implicit_id} @@ -69,7 +73,6 @@ List @contexts with no previous created @context ... ${kind} END - Create initial ImplicitlyCreated @context ${subscription_payload}= Load JSON From File ${EXECDIR}/data/${subscription_payload_file_path} @@ -93,9 +96,9 @@ Create initial ImplicitlyCreated @context Set Suite Variable ${list_contexts} ${response}= Serve a @context ${implicit_id} Check Response Status Code 200 ${response.status_code} - + ${data}= Set Variable ${response.json()} - + Check Context Response Body Containing numberOfHits value ${data} 1 Delete Initial @context Data diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_07.robot b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_07.robot index 5691abea7..61993134c 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_07.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ListContexts/052_07.robot @@ -12,18 +12,19 @@ Test Template List @contexts with several previous created @context *** Variables *** -${entity_filename}= building-simple-attributes.json -${contextUri}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld -${reason_200}= OK -${reason_204}= No Content +${entity_filename}= building-simple-attributes.json +${contextUri}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld +${reason_200}= OK +${reason_204}= No Content ${building_id_prefix}= urn:ngsi-ld:Building: -${content_type}= application/json +${content_type}= application/json + *** Test Cases *** DETAILS KIND 052_07_01 List @contexts with details set to true and kind set to cached and with previously several add @contexts [Tags] ctx-list 5_13_3 since_v1.5.1 true Cached -#052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts +# 052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts # [Tags] ctx-list 5_13_3 since_v1.5.1 # true ImplicitlyCreated @@ -37,7 +38,7 @@ Create Initial Cached @context from entity ... ${entity_id} ... ${content_type} ... ${contextUri} - + Check Response Status Code 201 ${response.status_code} List @contexts with several previous created @context diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_03.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_03.robot index 74c5b3a97..7b0987755 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_03.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_03.robot @@ -22,12 +22,12 @@ ${reason_422}= Unprocessable Content 053_03_01 Serve a @contexts with a wrong id and correct details [Tags] ctx-serve 5_13_4 since_v1.5.1 wrong_id_context true 404 ${reason_404} ${ERROR_TYPE_RESOURCE_NOT_FOUND} -#Deactivated because of boolean parsing -#053_03_02 Serve a @contexts with a valid id and incorrect details +# Deactivated because of boolean parsing +# 053_03_02 Serve a @contexts with a valid id and incorrect details # [Tags] ctx-serve 5_13_4 since_v1.5.1 # ${uri} other 400 ${reason_400} ${ERROR_TYPE_BAD_REQUEST_DATA} -#Why exactly should this produce a 422? -#053_03_03 Serve a Cached @contexts with details set to false +# Why exactly should this produce a 422? +# 053_03_03 Serve a Cached @contexts with details set to false # [Tags] ctx-serve 5_13_4 since_v1.5.1 # ${cached_id} false 422 ${reason_422} ${ERROR_OPERATION_NOT_SUPPORTED} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot index 285e7823f..45bf249cd 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot @@ -29,7 +29,7 @@ ${reason_200}= OK 053_05_01 Check that the context served by a context server is still in the broker after a ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE with details=true [Documentation] Check that the context served by a context server is still in the broker after a ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE with details=true [Tags] ctx-serve 5_13_4 since_v1.5.1 - ${response}= List @contexts ${TRUE} + ${response}= List @contexts ${TRUE} Log ${response} ${response}= Serve a @context ... contextId=${uri} @@ -62,7 +62,7 @@ Create Initial @context condition from an external server Log Waiting 3 seconds to continue... Sleep 3s - ${response}= List @contexts ${TRUE} + ${response}= List @contexts ${TRUE} Log ${response} ${response}= Serve a @context ${uri} true Check Response Status Code 200 ${response.status_code} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot index 6d56fd3a5..d93da4623 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot @@ -50,7 +50,7 @@ Create Initial @context condition from an external server ${first_existing_entity_id}= Generate Random Entity Id ${testing_id_prefix} Set Global Variable ${first_existing_entity_id} - #${uri}= Catenate http://${context_server_host}:${context_server_port}${uri} + # ${uri}= Catenate http://${context_server_host}:${context_server_port}${uri} Set Global Variable ${uri} Create Entity selecting @context ${entityfile} ${uri} ${first_existing_entity_id} diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_07.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_07.robot index cda21ba2e..2f57ab049 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_07.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_07.robot @@ -60,7 +60,6 @@ Create initial ImplicitlyCreated @context ... ${subscription_payload_file_path} ... ${CONTENT_TYPE_LD_JSON} - ${response}= Retrieve Subscription ${subscription_id} ${data}= Set Variable ${response.json()} ${implicit_id}= Get From Dictionary ${response.json()} jsonldContext diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_08.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_08.robot index fcbfe7ae7..07555bc58 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_08.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_08.robot @@ -62,13 +62,11 @@ Create initial ImplicitlyCreated @context ${implicit_id_full}= Get From Dictionary ${response.json()} jsonldContext ${implicit_id}= Evaluate '${implicit_id_full}'.split('/')[-1] Set Global Variable ${implicit_id} - Set Global Variable ${implicit_id_full} + Set Global Variable ${implicit_id_full} Set Suite Variable ${subscription_id} Set Suite Variable ${list_contexts} Check Context Response Body Containing numberOfHits value ${data} 0 - - Delete Initial @context Data Delete Subscription ${subscription_id} FOR ${uri} IN @{list_contexts} diff --git a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_03.robot b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_03.robot index a15776d91..1e7ab985e 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_03.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_03.robot @@ -1,6 +1,7 @@ *** Settings *** Documentation Check that one can delete a previous created cached @context without reload param -Variables ${EXECDIR}/resources/variables.py + +Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils/jsonldContext.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/AssertionUtils.resource @@ -11,11 +12,11 @@ Test Teardown Delete Initial @context *** Variables *** -${filename}= @context-cached-one-valid.json -${entity_filename}= building-simple-attributes.json +${filename}= @context-cached-one-valid.json +${entity_filename}= building-simple-attributes.json ${building_id_prefix}= urn:ngsi-ld:Building: -${content_type}= application/json -${reason_204}= No Content +${content_type}= application/json +${reason_204}= No Content *** Test Cases *** @@ -45,8 +46,7 @@ Create Initial cached @context ... ${entity_id} ... ${content_type} ... ${url}${uri} - - + ${response}= Delete Entity By Id ${entity_id} ${response}= Serve a @context ${contextId} true Check Response Kind set to ${response.json()} Cached diff --git a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot index 6b64dabec..c63d2aff0 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot @@ -42,7 +42,7 @@ ${uri} /api/v1/context.jsonld Create Initial @context condition from an external server Start @context Local Server - #${uri}= Catenate http://${context_server_host}:${context_server_port}${uri} + # ${uri}= Catenate http://${context_server_host}:${context_server_port}${uri} Set Global Variable ${uri} Create Entity selecting @context ${entityfile} ${uri} diff --git a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_06.robot b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_06.robot index 5a1da7857..9545f14ae 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_06.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_06.robot @@ -55,8 +55,6 @@ Create initial ImplicitlyCreated @context Set Suite Variable ${list_contexts} Check Context Response Body Containing numberOfHits value ${data} 0 - - Delete Initial @context Data Delete Subscription ${subscription_id} FOR ${uri} IN @{list_contexts} diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 3815e4c66..667688c48 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -211,7 +211,12 @@ Retrieve Attributes RETURN ${response} Retrieve Entity by Id - [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${base_url}=${url} ${options}=${EMPTY} + [Arguments] + ... ${id} + ... ${accept}=${CONTENT_TYPE_LD_JSON} + ... ${context}=${EMPTY} + ... ${local}=${EMPTY} + ... ${options}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} @@ -221,7 +226,7 @@ Retrieve Entity by Id ... ${headers} ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" END - IF '${local}'!='' Set To Dictionary ${params} local=${local} + IF '${local}'!='' Set To Dictionary ${params} local=${local} IF ${options_length}>0 Set To Dictionary ${params} options=${options} END diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 318342466..e8ca1df15 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -667,7 +667,7 @@ Check Context Response Body Containing a list of identifiers ${found}= Set Variable ${TRUE} IF ${details} FOR ${index} ${uri_context} IN ENUMERATE @{list_contexts} - ${found}= Set Variable ${FALSE} + ${found}= Set Variable ${FALSE} FOR ${index2} ${respObj} IN ENUMERATE @{response_body} ${uri}= Evaluate urllib.parse.unquote("${respObj['URL']}") modules=urllib ${entryFound}= Run Keyword And Return Status Should End With ${uri} ${uri_context} @@ -678,7 +678,7 @@ Check Context Response Body Containing a list of identifiers Check Response Body Might Contain Optional Fields ${respObj} numberOfHits Check Response Body Might Contain Optional Fields ${respObj} extraInfo END - ${found}= Set Variable ${TRUE} + ${found}= Set Variable ${TRUE} BREAK END END @@ -686,12 +686,12 @@ Check Context Response Body Containing a list of identifiers END ELSE FOR ${index} ${uri_context} IN ENUMERATE @{list_contexts} - ${found}= Set Variable ${FALSE} + ${found}= Set Variable ${FALSE} FOR ${index2} ${respObj} IN ENUMERATE @{response_body} ${uri}= Evaluate urllib.parse.unquote("${respObj}") modules=urllib ${entryFound}= Run Keyword And Return Status Should End With ${uri} ${uri_context} IF ${entryFound} - ${found}= Set Variable ${TRUE} + ${found}= Set Variable ${TRUE} BREAK END END @@ -700,7 +700,6 @@ Check Context Response Body Containing a list of identifiers Should Be True ${found} END - Check Context Response Body Containing a list with several URLs [Arguments] ${response_body} ${expected_length} ${list_contexts} @@ -735,8 +734,16 @@ Check Cached @Contexts Check Context Detailed Information Keys [Arguments] ${my_dict} - - ${expected_keys}= Create List URL localId kind createdAt lastUsage numberOfHits extraInfo body expiresAt + ${expected_keys}= Create List + ... URL + ... localId + ... kind + ... createdAt + ... lastUsage + ... numberOfHits + ... extraInfo + ... body + ... expiresAt ${actual_keys}= Get Dictionary Keys ${my_dict} FOR ${key} IN @{expected_keys} @@ -818,11 +825,12 @@ Check Message Field Equal Check Body With Alternatives [Arguments] ${response_body} ${alternatives} - ${result}= Set Variable ${False} - FOR ${alternative} IN @{alternatives} - ${result}= Run Keyword And Return Status Check Response Body Content expectation_filename=${alternative} response_body=${response_body} - IF ${result} - BREAK - END + ${result}= Set Variable ${False} + FOR ${alternative} IN @{alternatives} + ${result}= Run Keyword And Return Status + ... Check Response Body Content + ... expectation_filename=${alternative} + ... response_body=${response_body} + IF ${result} BREAK END - Should Be True ${result} \ No newline at end of file + Should Be True ${result} -- GitLab From 2a97ce2e6b83ceb24620639047bebc7328d8edc3 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Mon, 28 Apr 2025 13:43:06 +0200 Subject: [PATCH 18/34] added new features in resources --- resources/ApiUtils/ContextInformationConsumption.resource | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 667688c48..1e335c8d2 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -211,12 +211,7 @@ Retrieve Attributes RETURN ${response} Retrieve Entity by Id - [Arguments] - ... ${id} - ... ${accept}=${CONTENT_TYPE_LD_JSON} - ... ${context}=${EMPTY} - ... ${local}=${EMPTY} - ... ${options}=${EMPTY} + [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${base_url}=${url} ${options}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} -- GitLab From 356c4b6189aacb7ac127368e11457410b20d1ba4 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Mon, 28 Apr 2025 13:45:10 +0200 Subject: [PATCH 19/34] updated test cases --- .../Provision/Entities/CreateEntity/D001_01_inc.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot index 9c387a4a4..9c903c00c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_inc.robot @@ -56,4 +56,4 @@ Setup Entity Id And Registration And Start Context Source Mock Server Delete Created Entity And Registration And Stop Context Source Mock Server Delete Context Source Registration ${registration_id} Delete Entity By Id ${entity_id} - Stop Context Source Mock Server + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 9c7716205a0ddda00da8a7796861b952c4d41dc6 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Thu, 22 May 2025 17:41:50 +0200 Subject: [PATCH 20/34] removed unused remote broker features --- .../UpdateEntityAttributes/D004_01_inc.robot | 2 -- doc/analysis/parseapiutilsfile.py | 5 +---- resources/ApiUtils/ContextInformationConsumption.resource | 7 +++---- resources/ApiUtils/ContextInformationProvision.resource | 8 ++++---- resources/variables.py | 4 ---- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot index 6c9228727..dba120eb1 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot @@ -39,8 +39,6 @@ D004_01_inc Query The Context Broker With Type Should Be True ${stub_count} > 0 @{entities_id}= Create List ${entity_id} - # ${response_query_remote}= Query Entities entity_types=Vehicle base_url=${remote_url} - # Check Response Status Code 200 ${response_query_remote.status_code} ${payload_list} Evaluate [$payload] Check Response Body Containing Entities URIS set to ${entities_id} ${payload_list} diff --git a/doc/analysis/parseapiutilsfile.py b/doc/analysis/parseapiutilsfile.py index de7ca3897..ca60c53b9 100644 --- a/doc/analysis/parseapiutilsfile.py +++ b/doc/analysis/parseapiutilsfile.py @@ -44,10 +44,7 @@ class ParseApiUtilsFile: if 'response' in url: url = [x for x in url.split(' ') if 'url' in x][0] - if 'base_url' not in url: - regex = r"\s*\.*\s*url=\$\{url\}\/(.*)" - else: - regex = r"\s*\.*\s*url=\$\{base_url\}\/(.*)" + regex = r"\s*\.*\s*url=\$\{url\}\/(.*)" match = re.match(pattern=regex, string=url) if match: diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 1e335c8d2..1aecf15bb 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -26,7 +26,6 @@ ${response} ${EMPTY} *** Keywords *** Query Entities [Arguments] - ... ${base_url}=${url} ... ${entity_ids}=${EMPTY} ... ${entity_types}=${EMPTY} ... ${accept}=${EMPTY} @@ -87,7 +86,7 @@ Query Entities IF '${q}'!='' Set To Dictionary ${params} q=${q} IF '${local}'!='' Set To Dictionary ${params} local=${local} ${response}= GET - ... url=${base_url}/${ENTITIES_ENDPOINT_PATH} + ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... headers=${headers} ... params=${params} ... expected_status=any @@ -211,7 +210,7 @@ Retrieve Attributes RETURN ${response} Retrieve Entity by Id - [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${base_url}=${url} ${options}=${EMPTY} + [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${options}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} @@ -226,7 +225,7 @@ Retrieve Entity by Id Set To Dictionary ${params} options=${options} END ${response}= GET - ... url=${base_url}/${ENTITIES_ENDPOINT_PATH}${id} + ... url=${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 defb0c4f1..41d3a7c06 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -151,12 +151,12 @@ Batch Upsert Entities RETURN ${response} Create Entity - [Arguments] ${filename} ${entity_id} ${base_url}=${url} + [Arguments] ${filename} ${entity_id} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST - ... url=${base_url}/${ENTITIES_ENDPOINT_PATH} + ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... json=${entity} ... headers=${headers} ... expected_status=any @@ -238,9 +238,9 @@ Delete Entity Attributes RETURN ${response} Delete Entity by Id - [Arguments] ${id} ${base_url}=${url} + [Arguments] ${id} ${response}= DELETE - ... url=${base_url}/${ENTITIES_ENDPOINT_PATH}${id} + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} ... expected_status=any IF ${delete_temporal_on_core_delete} Delete Temporal Representation Of Entity ${id} diff --git a/resources/variables.py b/resources/variables.py index f570a71ec..738576829 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -14,10 +14,6 @@ core_context = 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld # whether the Temporal Representation of an Entity should be deleted when an Entity is deleted delete_temporal_on_core_delete = True -#DistOps variables -remote_url = 'http://0.0.0.0:8081/ngsi-ld/v1' -context_source_endpoint = 'http://0.0.0.0:8081' - # GitHub repository details # github_owner = 'your_github_username' # github_broker_repo = 'context_broker_repository' -- GitLab From e5d2ed3f73440193c5ef005f4b8fb1b46069b574 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Fri, 23 May 2025 10:38:14 +0200 Subject: [PATCH 21/34] updated initial_setup.py --- .../Entities/CreateEntity/D001_02_inc.robot | 4 +- doc/analysis/initial_setup.py | 57 +++++-------------- 2 files changed, 15 insertions(+), 46 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index 95c8dd7be..f834d9b98 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -9,7 +9,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/MockServerUtils.resource -Test Setup Setup Initial Context Source Registration And Start Context Source Mock Server +Test Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Created Registration And Stop Context Source Mock Server @@ -34,7 +34,7 @@ D001_02_inc Request to create an entity with a malformed id on both Context Brok Should Be Empty ${response_query.json()} *** Keywords *** -Setup Initial Context Source Registration And Start Context Source Mock Server +Setup Registration And Start Context Source Mock Server ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${context_source_registration_id} ${registration_payload}= Prepare Context Source Registration From File diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 90519e90e..019d1a0a7 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -42,12 +42,10 @@ class InitialSetup: 'Create Initial hosted @context': InitialSetup.create_hosted_context(), 'Create Initial @context condition from an external server': InitialSetup.create_from_external_server(), 'Delete core context and reload it': InitialSetup.delete_core_context(), - 'Setup Entities And Registration': InitialSetup.init_entities_and_csr(), - 'Setup Entity Id And Registration': InitialSetup.init_eid_and_csr(), - 'Setup Entity On Remote And Registration': InitialSetup.init_remote_entity_and_csr(), - 'Setup Entity On Local And Registration': InitialSetup.init_local_entity_and_csr(), - 'Create Entities With Different Payloads And Registration': InitialSetup.init_diff_entities_and_csr(), - 'Create Initial Cached @context from entity': InitialSetup.init_cached_conctext() + 'Setup Entity Id And Registration And Start Context Source Mock Server': InitialSetup.init_eid_and_csr_and_ms(), + 'Setup Registration And Start Context Source Mock Server': InitialSetup.init_csr_and_ms(), + 'Create Entity And Registration On The Context Broker And Start Context Source Mock Server': InitialSetup.init_local_entity_and_csr_and_ms(), + 'Create Initial Cached @context from entity': InitialSetup.init_cached_context() } self.folder_test_suites = dirname(dirname(dirname(__file__))) @@ -225,7 +223,7 @@ class InitialSetup: return data @staticmethod - def init_cached_conctext(): + def init_cached_context(): data = '''with { the SUT containing a cached context from creating an entity. }''' @@ -274,44 +272,30 @@ class InitialSetup: return data @staticmethod - def init_entities_and_csr() -> str: - data = '''with { - the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on both the Context Broker and Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing a Context Source Registration - with id equal to ${registration_id} - and payload set to ${registration_payload_file_path} -}''' - return data - - @staticmethod - def init_eid_and_csr() -> str: + def init_eid_and_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and the SUT containing an initial Entity id set to ${entity_id} and the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data @staticmethod - def init_remote_entity_and_csr() -> str: + def init_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on the Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing a Context Source Registration + the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data - + @staticmethod - def init_local_entity_and_csr() -> str: + def init_local_entity_and_csr_and_ms() -> str: data = '''with { the SUT being in the "initial state" and the SUT containing an initial Entity ${entity} on the Context Broker @@ -320,25 +304,10 @@ class InitialSetup: and the SUT containing a Context Source Registration with id equal to ${registration_id} and payload set to ${registration_payload_file_path} + and the SUT containing a Context Source Mock Server }''' return data - @staticmethod - def init_diff_entities_and_csr() -> str: - data = '''with { - the SUT being in the "initial state" and - the SUT containing an initial Entity ${entity} on the Context Broker - with an id set to ${entity_id} - and payload set to ${entity_payload_filename} - and the SUT containing an initial Entity ${entity} on the Context Source - with an id set to ${entity_id} - and payload set to ${entity_payload_filename2} - and the SUT containing a Context Source Registration - with id equal to ${registration_id} - and payload set to ${registration_payload_file_path} -}''' - return data - def get_property_values(self, root_folder: str, property_name: str) -> [str, str]: robot_files_without_setup = list() robot_files_with_setup = list() -- GitLab From e4975eeee32f922e979cdf432dc2797d9eb62c42 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Fri, 23 May 2025 10:39:21 +0200 Subject: [PATCH 22/34] replaced files in doc folder --- .../Consumption/063_01_inc.json | 38 --------------- .../Consumption/063_02_inc.json | 38 --------------- .../Consumption/064_02_inc.json | 38 --------------- .../Consumption/D010_01_inc.json | 44 ++++++++++++++++++ .../Consumption/D010_02_inc.json | 46 +++++++++++++++++++ ...064_01_01_inc.json => D011_01_01_inc.json} | 26 +++++++---- ...064_01_02_inc.json => D011_01_02_inc.json} | 26 +++++++---- ...064_01_03_inc.json => D011_01_03_inc.json} | 26 +++++++---- ...064_01_04_inc.json => D011_01_04_inc.json} | 26 +++++++---- ...064_01_05_inc.json => D011_01_05_inc.json} | 28 ++++++----- .../Consumption/D011_02_inc.json | 46 +++++++++++++++++++ .../Provision/054_03_02_inc.json | 38 --------------- .../Provision/055_01_inc.json | 38 --------------- .../{054_01_inc.json => D001_01_inc.json} | 26 +++++++---- .../{054_02_inc.json => D001_02_inc.json} | 30 +++++++----- ...054_03_01_inc.json => D001_03_01_inc.json} | 30 +++++++----- .../Provision/D001_03_02_inc.json | 46 +++++++++++++++++++ ...054_03_03_inc.json => D001_03_03_inc.json} | 30 +++++++----- .../Provision/D002_01_inc.json | 44 ++++++++++++++++++ ...055_02_01_inc.json => D002_02_01_inc.json} | 30 +++++++----- ...055_02_02_inc.json => D002_02_02_inc.json} | 30 +++++++----- .../{057_01_inc.json => D004_01_inc.json} | 26 +++++++---- 22 files changed, 434 insertions(+), 316 deletions(-) delete mode 100644 doc/files/DistributedOperations/Consumption/063_01_inc.json delete mode 100644 doc/files/DistributedOperations/Consumption/063_02_inc.json delete mode 100644 doc/files/DistributedOperations/Consumption/064_02_inc.json create mode 100644 doc/files/DistributedOperations/Consumption/D010_01_inc.json create mode 100644 doc/files/DistributedOperations/Consumption/D010_02_inc.json rename doc/files/DistributedOperations/Consumption/{064_01_01_inc.json => D011_01_01_inc.json} (51%) rename doc/files/DistributedOperations/Consumption/{064_01_02_inc.json => D011_01_02_inc.json} (50%) rename doc/files/DistributedOperations/Consumption/{064_01_03_inc.json => D011_01_03_inc.json} (53%) rename doc/files/DistributedOperations/Consumption/{064_01_04_inc.json => D011_01_04_inc.json} (53%) rename doc/files/DistributedOperations/Consumption/{064_01_05_inc.json => D011_01_05_inc.json} (53%) create mode 100644 doc/files/DistributedOperations/Consumption/D011_02_inc.json delete mode 100644 doc/files/DistributedOperations/Provision/054_03_02_inc.json delete mode 100644 doc/files/DistributedOperations/Provision/055_01_inc.json rename doc/files/DistributedOperations/Provision/{054_01_inc.json => D001_01_inc.json} (56%) rename doc/files/DistributedOperations/Provision/{054_02_inc.json => D001_02_inc.json} (50%) rename doc/files/DistributedOperations/Provision/{054_03_01_inc.json => D001_03_01_inc.json} (59%) create mode 100644 doc/files/DistributedOperations/Provision/D001_03_02_inc.json rename doc/files/DistributedOperations/Provision/{054_03_03_inc.json => D001_03_03_inc.json} (51%) create mode 100644 doc/files/DistributedOperations/Provision/D002_01_inc.json rename doc/files/DistributedOperations/Provision/{055_02_01_inc.json => D002_02_01_inc.json} (59%) rename doc/files/DistributedOperations/Provision/{055_02_02_inc.json => D002_02_02_inc.json} (50%) rename doc/files/DistributedOperations/Provision/{057_01_inc.json => D004_01_inc.json} (52%) diff --git a/doc/files/DistributedOperations/Consumption/063_01_inc.json b/doc/files/DistributedOperations/Consumption/063_01_inc.json deleted file mode 100644 index 6d396151d..000000000 --- a/doc/files/DistributedOperations/Consumption/063_01_inc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/063_01_Inc", - "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker the request gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.1", - "config_id": "", - "parent_release": "v1.6.1", - "clauses": [ - "5.7.1" - ], - "pics_selection": "", - "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" - ], - "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 Source\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}", - "test_cases": [ - { - "name": "063_01_inc Retrieve entity on a Context Source from the Context Broker", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/063_01_inc", - "doc": "Check that if one retrieves entity living on a Context Source from a Context Broker, entity gets returned", - "tags": [ - "5_7_1", - "additive-inclusive", - "dist-ops", - "since_v1.6.1" - ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", - "template": null, - "http_verb": "GET", - "endpoint": "entities/{id}" - } - ], - "permutations": [], - "robotpath": "DistributedOperations/Consumption/Entity/RetrieveEntity", - "robotfile": "063_01_inc" -} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/063_02_inc.json b/doc/files/DistributedOperations/Consumption/063_02_inc.json deleted file mode 100644 index fb33d887a..000000000 --- a/doc/files/DistributedOperations/Consumption/063_02_inc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/063_02_Inc", - "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker with local flag entity not found error is raised", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.1", - "config_id": "", - "parent_release": "v1.6.1", - "clauses": [ - "5.7.1" - ], - "pics_selection": "", - "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" - ], - "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 Source\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}", - "test_cases": [ - { - "name": "063_02_inc Retrieve entity on a Context Source from the Context Broker with local flag", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/063_02_inc", - "doc": "Check that if one retrieves entity living on a Context Source from a Context Broker with local flag, entity not found error is raised", - "tags": [ - "5_7_1", - "additive-inclusive", - "dist-ops", - "since_v1.6.1" - ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", - "template": null, - "http_verb": "GET", - "endpoint": "entities/{id}" - } - ], - "permutations": [], - "robotpath": "DistributedOperations/Consumption/Entity/RetrieveEntity", - "robotfile": "063_02_inc" -} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_02_inc.json b/doc/files/DistributedOperations/Consumption/064_02_inc.json deleted file mode 100644 index 3b7f825e4..000000000 --- a/doc/files/DistributedOperations/Consumption/064_02_inc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_02_Inc", - "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker with local flag entity not found error is raised", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", - "config_id": "", - "parent_release": "v1.6.1", - "clauses": [ - "5.7.2" - ], - "pics_selection": "", - "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" - ], - "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 Source\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}", - "test_cases": [ - { - "name": "064_02_inc Query The Context Broker With Local Flag", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_02_inc", - "doc": "Check that if one queries with the local flag, no entity from Context Source gets returned", - "tags": [ - "5_7_2", - "additive-inclusive", - "dist-ops", - "since_v1.6.1" - ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", - "template": null, - "http_verb": "GET", - "endpoint": "entities/" - } - ], - "permutations": [], - "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_02_inc" -} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/D010_01_inc.json b/doc/files/DistributedOperations/Consumption/D010_01_inc.json new file mode 100644 index 000000000..c138ca79d --- /dev/null +++ b/doc/files/DistributedOperations/Consumption/D010_01_inc.json @@ -0,0 +1,44 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D010_01_inc", + "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker the request gets forwarded to the Context Source correctly", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Setup Registration And Start Context Source Mock Server", + "Delete 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 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": "D010_01_inc Retrieve entity on a Context Source from the Context Broker", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D010_01_inc", + "doc": "Check that if one retrieves entity living on a Context Source from a Context Broker, entity gets returned", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_7_1", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Consumption/Entity/RetrieveEntity", + "robotfile": "D010_01_inc", + "error_while_autogenerating": "no error" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/D010_02_inc.json b/doc/files/DistributedOperations/Consumption/D010_02_inc.json new file mode 100644 index 000000000..f0f9d6f07 --- /dev/null +++ b/doc/files/DistributedOperations/Consumption/D010_02_inc.json @@ -0,0 +1,46 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D010_02_inc", + "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one retrieves entity from the Context Broker with local flag entity not found error is raised", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.1, 6.3.18", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.7.1", + "6.3.18" + ], + "pics_selection": "", + "keywords": [ + "Setup Registration And Start Context Source Mock Server", + "Delete 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 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": "D010_02_inc Retrieve entity on a Context Source from the Context Broker with local flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D010_02_inc", + "doc": "Check that if one retrieves entity living on a Context Source from a Context Broker with local flag, entity not found error is raised", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_7_1", + "6_3_18", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Consumption/Entity/RetrieveEntity", + "robotfile": "D010_02_inc", + "error_while_autogenerating": "no error" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_01_01_inc.json b/doc/files/DistributedOperations/Consumption/D011_01_01_inc.json similarity index 51% rename from doc/files/DistributedOperations/Consumption/064_01_01_inc.json rename to doc/files/DistributedOperations/Consumption/D011_01_01_inc.json index 66d938f90..8c8de7c8d 100644 --- a/doc/files/DistributedOperations/Consumption/064_01_01_inc.json +++ b/doc/files/DistributedOperations/Consumption/D011_01_01_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_01_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_01_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.7.2" ], "pics_selection": "", "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" + "Setup Registration And Start Context Source Mock Server", + "Delete 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 Source\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}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "064_01_01_inc Query The Context Broker With Type", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_01_inc", + "name": "D011_01_01_inc Query The Context Broker With Type", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_01_inc", "doc": "Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets returned", "tags": [ + "4_3_3", + "4_3_6_2", "5_7_2", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", "template": null, "http_verb": "GET", "endpoint": "entities/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_01_01_inc" + "robotfile": "D011_01_01_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_01_02_inc.json b/doc/files/DistributedOperations/Consumption/D011_01_02_inc.json similarity index 50% rename from doc/files/DistributedOperations/Consumption/064_01_02_inc.json rename to doc/files/DistributedOperations/Consumption/D011_01_02_inc.json index 61972f981..c018505ff 100644 --- a/doc/files/DistributedOperations/Consumption/064_01_02_inc.json +++ b/doc/files/DistributedOperations/Consumption/D011_01_02_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_02_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_02_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.7.2" ], "pics_selection": "", "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" + "Setup Registration And Start Context Source Mock Server", + "Delete 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 Source\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}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "064_01_02_inc Query The Context Broker With Type And Missing Attribute", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_02_inc", + "name": "D011_01_02_inc Query The Context Broker With Type And Missing Attribute", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_02_inc", "doc": "Check that if one queries for type and an attribute that is missing, no entity gets returned", "tags": [ + "4_3_3", + "4_3_6_2", "5_7_2", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", "template": null, "http_verb": "GET", "endpoint": "entities/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_01_02_inc" + "robotfile": "D011_01_02_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_01_03_inc.json b/doc/files/DistributedOperations/Consumption/D011_01_03_inc.json similarity index 53% rename from doc/files/DistributedOperations/Consumption/064_01_03_inc.json rename to doc/files/DistributedOperations/Consumption/D011_01_03_inc.json index d6c747495..e8b207d5e 100644 --- a/doc/files/DistributedOperations/Consumption/064_01_03_inc.json +++ b/doc/files/DistributedOperations/Consumption/D011_01_03_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_03_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_03_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.7.2" ], "pics_selection": "", "keywords": [ - "Create Entities With Different Payloads And Registration", - "Delete Created Entities And Registration" + "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 an initial Entity ${entity} on the Context Source\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename2}\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}", + "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": "064_01_03_inc Query The Context Broker With Type and Attribute", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_03_inc", + "name": "D011_01_03_inc Query The Context Broker With Type and Attribute", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_03_inc", "doc": "Check that if one queries for attribute present in an entity on a Context Source, only that entity gets returned", "tags": [ + "4_3_3", + "4_3_6_2", "5_7_2", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Create Entities With Different Payloads And Registration", - "teardown": "Delete Created Entities And Registration", + "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/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_01_03_inc" + "robotfile": "D011_01_03_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_01_04_inc.json b/doc/files/DistributedOperations/Consumption/D011_01_04_inc.json similarity index 53% rename from doc/files/DistributedOperations/Consumption/064_01_04_inc.json rename to doc/files/DistributedOperations/Consumption/D011_01_04_inc.json index 5603e16f6..c11bf4c8f 100644 --- a/doc/files/DistributedOperations/Consumption/064_01_04_inc.json +++ b/doc/files/DistributedOperations/Consumption/D011_01_04_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_04_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_04_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one entity on it and another on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.7.2" ], "pics_selection": "", "keywords": [ - "Create Entities With Different Payloads And Registration", - "Delete Created Entities And Registration" + "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 an initial Entity ${entity} on the Context Source\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename2}\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}", + "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": "064_01_04_inc Query The Context Broker With Type and Attribute In Neither", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_04_inc", + "name": "D011_01_04_inc Query The Context Broker With Type and Attribute In Neither", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_04_inc", "doc": "Check that if one queries for attribute present in neither of the entities, neither of them gets returned", "tags": [ + "4_3_3", + "4_3_6_2", "5_7_2", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Create Entities With Different Payloads And Registration", - "teardown": "Delete Created Entities And Registration", + "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/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_01_04_inc" + "robotfile": "D011_01_04_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/064_01_05_inc.json b/doc/files/DistributedOperations/Consumption/D011_01_05_inc.json similarity index 53% rename from doc/files/DistributedOperations/Consumption/064_01_05_inc.json rename to doc/files/DistributedOperations/Consumption/D011_01_05_inc.json index 58611d3fa..1d86e0096 100644 --- a/doc/files/DistributedOperations/Consumption/064_01_05_inc.json +++ b/doc/files/DistributedOperations/Consumption/D011_01_05_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_05_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_05_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, entities with same id on the Context Broker and on a Context Source, if one queries the Context Broker the query gets forwarded to the Context Source correctly", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.7.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.7.2" ], "pics_selection": "", "keywords": [ - "Create Entities With Different Payloads And Registration", - "Delete Created Entities And Registration" + "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 an initial Entity ${entity} on the Context Source\n with an id set to ${entity_id}\n and payload set to ${entity_payload_filename2}\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}", + "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": "064_01_05_inc Query The Context Broker With Type", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/064_01_05_inc", + "name": "D011_01_05_inc Query The Context Broker With Type", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_01_05_inc", "doc": "Check that entities on the Context Broker and Context Source with the same id get merged and returned as one entity", "tags": [ + "4_3_3", + "4_3_6_2", "5_7_2", - "additive-inclusive", + "additive-auxiliary", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Create Entities With Different Payloads And Registration", - "teardown": "Delete Created Entities And Registration", + "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/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", - "robotfile": "064_01_05_inc" + "robotfile": "D011_01_05_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Consumption/D011_02_inc.json b/doc/files/DistributedOperations/Consumption/D011_02_inc.json new file mode 100644 index 000000000..b383518cb --- /dev/null +++ b/doc/files/DistributedOperations/Consumption/D011_02_inc.json @@ -0,0 +1,46 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_02_inc", + "test_objective": "Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker with local flag entity not found error is raised", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.7.2, 6.3.18", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.7.2", + "6.3.18" + ], + "pics_selection": "", + "keywords": [ + "Setup Registration And Start Context Source Mock Server", + "Delete 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 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": "D011_02_inc Query The Context Broker With Local Flag", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Cons/E/D011_02_inc", + "doc": "Check that if one queries with the local flag, no entity from Context Source gets returned", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_7_2", + "6_3_18", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Consumption/Entity/QueryEntities", + "robotfile": "D011_02_inc", + "error_while_autogenerating": "no error" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/054_03_02_inc.json b/doc/files/DistributedOperations/Provision/054_03_02_inc.json deleted file mode 100644 index e6bc1a5db..000000000 --- a/doc/files/DistributedOperations/Provision/054_03_02_inc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_02_Inc", - "test_objective": "Verify that, when one has an entity on a Context Broker and on a Context Source and an inclusive registration on the Context Broker, one is not able to create that entity on the Context Source from the Context Broker", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.1", - "config_id": "", - "parent_release": "v1.6.1", - "clauses": [ - "5.6.1" - ], - "pics_selection": "", - "keywords": [ - "Setup Entities And Registration", - "Delete Created Entities And Registration" - ], - "teardown": "None", - "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on both the Context Broker and Context Source\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}", - "test_cases": [ - { - "name": "054_03_02_inc Create entity already existing on both Context Broker and Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_02_inc", - "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists both locally and remotely, this raises an error on both Context Broker and Context Source", - "tags": [ - "5_6_1", - "additive-inclusive", - "dist-ops", - "since_v1.6.1" - ], - "setup": "Setup Entities And Registration", - "teardown": "Delete Created Entities And Registration", - "template": null, - "http_verb": "POST", - "endpoint": "entities/" - } - ], - "permutations": [], - "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", - "robotfile": "054_03_02_inc" -} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/055_01_inc.json b/doc/files/DistributedOperations/Provision/055_01_inc.json deleted file mode 100644 index 8384ab7bd..000000000 --- a/doc/files/DistributedOperations/Provision/055_01_inc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_01_Inc", - "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.6", - "config_id": "", - "parent_release": "v1.6.1", - "clauses": [ - "5.6.6" - ], - "pics_selection": "", - "keywords": [ - "Setup Entities And Registration", - "Delete Created Entities And Registration" - ], - "teardown": "None", - "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} on both the Context Broker and Context Source\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}", - "test_cases": [ - { - "name": "055_01_inc Delete Entities On Both Context Broker and Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_01_inc", - "doc": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source", - "tags": [ - "5_6_6", - "additive-inclusive", - "dist-ops", - "since_v1.6.1" - ], - "setup": "Setup Entities And Registration", - "teardown": "Delete Created Entities And Registration", - "template": null, - "http_verb": "DELETE", - "endpoint": "entities/{id}" - } - ], - "permutations": [], - "robotpath": "DistributedOperations/Provision/Entities/DeleteEntity", - "robotfile": "055_01_inc" -} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/054_01_inc.json b/doc/files/DistributedOperations/Provision/D001_01_inc.json similarity index 56% rename from doc/files/DistributedOperations/Provision/054_01_inc.json rename to doc/files/DistributedOperations/Provision/D001_01_inc.json index 7b1d732a6..3e8333940 100644 --- a/doc/files/DistributedOperations/Provision/054_01_inc.json +++ b/doc/files/DistributedOperations/Provision/D001_01_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_01_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_01_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to create entities on both Context Broker and Context Source", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.1", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.1", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.6.1" ], "pics_selection": "", "keywords": [ - "Setup Entity Id And Registration", - "Delete Created Entities And Registration" + "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}", + "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": "054_01_inc Create Entity On Both Context Broker and Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_01_inc", + "name": "D001_01_inc Create Entity On Both Context Broker and Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_01_inc", "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration, this is created on the Context Source too", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_1", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity Id And Registration", - "teardown": "Delete Created Entities And Registration", + "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": "entities/" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", - "robotfile": "054_01_inc" + "robotfile": "D001_01_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/054_02_inc.json b/doc/files/DistributedOperations/Provision/D001_02_inc.json similarity index 50% rename from doc/files/DistributedOperations/Provision/054_02_inc.json rename to doc/files/DistributedOperations/Provision/D001_02_inc.json index 1d88164b0..01d327da6 100644 --- a/doc/files/DistributedOperations/Provision/054_02_inc.json +++ b/doc/files/DistributedOperations/Provision/D001_02_inc.json @@ -1,32 +1,39 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_02_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_02_inc", "test_objective": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.1", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.1, 6.3.3", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "5.6.1" + "4.3.3", + "4.3.6.2", + "5.6.1", + "6.3.3" ], "pics_selection": "", "keywords": [ - "Setup Initial Context Source Registration", - "Delete Created Registration" + "Setup Registration And Start Context Source Mock Server", + "Delete Created Registration And Stop Context Source Mock Server" ], "teardown": "None", - "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "054_02_inc Request to create an entity with a malformed id on both Context Broker and Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_02_inc", + "name": "D001_02_inc Request to create an entity with a malformed id on both Context Broker and Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_02_inc", "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration but is malformed, this is created neither on the Context Broker nor on the Context Source", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_1", + "6_3_3", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Initial Context Source Registration", - "teardown": "Delete Created Registration", + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Created Registration And Stop Context Source Mock Server", "template": null, "http_verb": "POST", "endpoint": "entities/" @@ -34,5 +41,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", - "robotfile": "054_02_inc" + "robotfile": "D001_02_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/054_03_01_inc.json b/doc/files/DistributedOperations/Provision/D001_03_01_inc.json similarity index 59% rename from doc/files/DistributedOperations/Provision/054_03_01_inc.json rename to doc/files/DistributedOperations/Provision/D001_03_01_inc.json index deb256379..f9b8d3596 100644 --- a/doc/files/DistributedOperations/Provision/054_03_01_inc.json +++ b/doc/files/DistributedOperations/Provision/D001_03_01_inc.json @@ -1,32 +1,39 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_01_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_01_inc", "test_objective": "Verify that, when one has an entity and an inclusive registration on a Context Broker, one is able to create that entity on a Context Source from the Context Broker but gets an error for the Context Broker", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.1", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.1, 6.3.3", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "5.6.1" + "4.3.3", + "4.3.6.2", + "5.6.1", + "6.3.3" ], "pics_selection": "", "keywords": [ - "Setup Entity On Local And Registration", - "Delete Created Entities And Registration" + "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}", + "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": "054_03_01_inc Create entity already existing locally on a Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_01_inc", + "name": "D001_03_01_inc Create entity already existing locally on a Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_01_inc", "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists locally, this raises an error on the Context Broker but is created correctly on the Context Source", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_1", + "6_3_3", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Local And Registration", - "teardown": "Delete Created Entities And Registration", + "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": "entities/" @@ -34,5 +41,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", - "robotfile": "054_03_01_inc" + "robotfile": "D001_03_01_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D001_03_02_inc.json b/doc/files/DistributedOperations/Provision/D001_03_02_inc.json new file mode 100644 index 000000000..2a8e0cb96 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D001_03_02_inc.json @@ -0,0 +1,46 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_02_inc", + "test_objective": "Verify that, when one has an entity on both Context Broker and Context Source and an inclusive registration on the Context Broker, one is not able to create that entity on the Context Source from the Context Broker", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.1, 6.3.3", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.1", + "6.3.3" + ], + "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": "D001_03_02_inc Create entity already existing on both Context Broker and Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_02_inc", + "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists both locally and remotely, this raises an error on both Context Broker and Context Source", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_1", + "6_3_3", + "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": "entities/" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", + "robotfile": "D001_03_02_inc", + "error_while_autogenerating": "no error" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/054_03_03_inc.json b/doc/files/DistributedOperations/Provision/D001_03_03_inc.json similarity index 51% rename from doc/files/DistributedOperations/Provision/054_03_03_inc.json rename to doc/files/DistributedOperations/Provision/D001_03_03_inc.json index 6ed309934..b13f0b892 100644 --- a/doc/files/DistributedOperations/Provision/054_03_03_inc.json +++ b/doc/files/DistributedOperations/Provision/D001_03_03_inc.json @@ -1,32 +1,39 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_03_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_03_inc", "test_objective": "Verify that, when one has an entity on a Context Source and an inclusive registration on a Context Broker, one is not able to create that entity on the Context Source from the Context Broker but one is able to create it on the Context Broker", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.1", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.1, 6.3.3", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "5.6.1" + "4.3.3", + "4.3.6.2", + "5.6.1", + "6.3.3" ], "pics_selection": "", "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entities And Registration" + "Setup 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 ${entity} on the Context Source\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}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "054_03_03_inc Create entity already existing remotely on the Context Broker", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/054_03_03_inc", + "name": "D001_03_03_inc Create entity already existing remotely on the Context Broker", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D001_03_03_inc", "doc": "Check that if one requests the Context Broker to create an entity that matches an inclusive registration and already exists remotely, this raises an error on the Context Source, but it works just fine on the Context Broker", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_1", + "6_3_3", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entities And Registration", + "setup": "Setup 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": "entities/" @@ -34,5 +41,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/CreateEntity", - "robotfile": "054_03_03_inc" + "robotfile": "D001_03_03_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D002_01_inc.json b/doc/files/DistributedOperations/Provision/D002_01_inc.json new file mode 100644 index 000000000..3a01d9a8c --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D002_01_inc.json @@ -0,0 +1,44 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_01_inc", + "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.6" + ], + "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": "D002_01_inc Delete Entities On Both Context Broker and Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_01_inc", + "doc": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on both Context Broker and Context Source", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_6", + "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": "DELETE", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/Entities/DeleteEntity", + "robotfile": "D002_01_inc", + "error_while_autogenerating": "no error" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/055_02_01_inc.json b/doc/files/DistributedOperations/Provision/D002_02_01_inc.json similarity index 59% rename from doc/files/DistributedOperations/Provision/055_02_01_inc.json rename to doc/files/DistributedOperations/Provision/D002_02_01_inc.json index 782e6ae81..6f6c8d78e 100644 --- a/doc/files/DistributedOperations/Provision/055_02_01_inc.json +++ b/doc/files/DistributedOperations/Provision/D002_02_01_inc.json @@ -1,32 +1,39 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_02_01_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_02_01_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.6", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.6, 6.3.3", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "5.6.6" + "4.3.3", + "4.3.6.2", + "5.6.6", + "6.3.3" ], "pics_selection": "", "keywords": [ - "Setup Entity On Local And Registration", - "Delete Created Entity And Registration" + "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "Delete 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}", + "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": "055_02_01_inc Delete Entity On The Context Broker", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_02_01_inc", + "name": "D002_02_01_inc Delete Entity On The Context Broker", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_02_01_inc", "doc": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_6", + "6_3_3", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Local And Registration", - "teardown": "Delete Created Entity And Registration", + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", "template": null, "http_verb": "DELETE", "endpoint": "entities/{id}" @@ -34,5 +41,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/DeleteEntity", - "robotfile": "055_02_01_inc" + "robotfile": "D002_02_01_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/055_02_02_inc.json b/doc/files/DistributedOperations/Provision/D002_02_02_inc.json similarity index 50% rename from doc/files/DistributedOperations/Provision/055_02_02_inc.json rename to doc/files/DistributedOperations/Provision/D002_02_02_inc.json index bc25df406..2fae7fa1b 100644 --- a/doc/files/DistributedOperations/Provision/055_02_02_inc.json +++ b/doc/files/DistributedOperations/Provision/D002_02_02_inc.json @@ -1,32 +1,39 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_02_02_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_02_02_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.6", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.6, 6.3.3", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "5.6.6" + "4.3.3", + "4.3.6.2", + "5.6.6", + "6.3.3" ], "pics_selection": "", "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" + "Setup Registration And Start Context Source Mock Server", + "Delete 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 Source\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}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "055_02_02_inc Delete Entity On a Context Source", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/055_02_02_inc", + "name": "D002_02_02_inc Delete Entity On a Context Source", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/E/D002_02_02_inc", "doc": "Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_6", + "6_3_3", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", "template": null, "http_verb": "DELETE", "endpoint": "entities/{id}" @@ -34,5 +41,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/Entities/DeleteEntity", - "robotfile": "055_02_02_inc" + "robotfile": "D002_02_02_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/057_01_inc.json b/doc/files/DistributedOperations/Provision/D004_01_inc.json similarity index 52% rename from doc/files/DistributedOperations/Provision/057_01_inc.json rename to doc/files/DistributedOperations/Provision/D004_01_inc.json index e1379fe91..e65df58a2 100644 --- a/doc/files/DistributedOperations/Provision/057_01_inc.json +++ b/doc/files/DistributedOperations/Provision/D004_01_inc.json @@ -1,32 +1,37 @@ { - "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/EA/057_01_Inc", + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/EA/D004_01_inc", "test_objective": "Verify that, when one has an inclusive registration on a Context Broker with redirectionOps, one is able to update entities on a Context Source", - "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.6.2", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.2", "config_id": "", "parent_release": "v1.6.1", "clauses": [ + "4.3.3", + "4.3.6.2", "5.6.2" ], "pics_selection": "", "keywords": [ - "Setup Entity On Remote And Registration", - "Delete Created Entity And Registration" + "Setup Registration And Start Context Source Mock Server", + "Delete 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 Source\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}", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n 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": "057_01_inc Query The Context Broker With Type", - "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/EA/057_01_inc", + "name": "D004_01_inc Query The Context Broker With Type", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/EA/D004_01_inc", "doc": "Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too", "tags": [ + "4_3_3", + "4_3_6_2", "5_6_2", "additive-inclusive", + "cf_06", "dist-ops", "since_v1.6.1" ], - "setup": "Setup Entity On Remote And Registration", - "teardown": "Delete Created Entity And Registration", + "setup": "Setup Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", "template": null, "http_verb": "PATCH", "endpoint": "entities/{entityId}/attrs/{attributeId}" @@ -34,5 +39,6 @@ ], "permutations": [], "robotpath": "DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes", - "robotfile": "057_01_inc" + "robotfile": "D004_01_inc", + "error_while_autogenerating": "no error" } \ No newline at end of file -- GitLab From cd025b2170ffe9c9c5fd91217edc38cde07d3ba3 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 20 May 2025 10:45:59 +0200 Subject: [PATCH 23/34] added filtering in documentation generation --- doc/statisticsDocumentationData.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/statisticsDocumentationData.py b/doc/statisticsDocumentationData.py index 65e09e8d9..3786cd9c2 100644 --- a/doc/statisticsDocumentationData.py +++ b/doc/statisticsDocumentationData.py @@ -16,7 +16,10 @@ if __name__ == "__main__": BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" fullpath = basedir + "/TP/NGSI-LD" + excluded_dirs = [''] for root, dirs, files in walk(fullpath): + if root == fullpath: + dirs[:] = [d for d in dirs if d not in excluded_dirs] for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 @@ -40,6 +43,8 @@ if __name__ == "__main__": # establish the right configuration if json_of_test_case["robotpath"].startswith("ContextSource"): json_of_test_case["config_id"] = "CF_05" + elif 'cf_06' in json_of_test_case["test_cases"][0]["tags"]: + json_of_test_case["config_id"] = "CF_06" else: json_of_test_case["config_id"] = "CF_01" @@ -63,7 +68,6 @@ if __name__ == "__main__": print("NO PERMUTATIONS in TESTCASE??? " + json_of_test_case["tp_id"]) exit(1) testcases.append(json_of_test_case) - print() print() print() -- GitLab From f93cf83dd382742f6f9d416ae442de7f83a5cca8 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Tue, 20 May 2025 10:46:29 +0200 Subject: [PATCH 24/34] added auxiliary registration mode test cases --- .../Entity/QueryEntities/D011_01_aux.robot | 61 +++++++++++++++++++ .../Entity/RetrieveEntity/D010_01_aux.robot | 61 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot new file mode 100644 index 000000000..400bb4839 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Verify that when an auxiliary registration exists on a Context Broker and an entity with the same ID exists both locally in the Context Broker and remotely in the Context Source with different attributes, a query request to the Context Broker is correctly forwarded to the Context Source, and the response includes the local entity enriched with additional, non-conflicting attributes from the Context Source + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +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 *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${entity_payload_filename2} vehicle-simple-attributes-second.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${fragment_filename} vehicle-brandname-fragment.json +${expected_attribute} brandName + +*** Test Cases *** +D011_01_aux Query entities that exists on both the Context Source and the Context Broker from the Context Broker + [Documentation] Check that if one queries the Context Broker for type, entities get merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} + ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing an Attribute set to ${expected_attribute} ${response.json()[0]} ${entity_fragment} + Should Have Value In Json ${response.json()[0]} $.isParked + Should Have Value In Json ${response.json()[0]} $.isParked2 + + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename2} ${entity_id} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot new file mode 100644 index 000000000..0d9743e64 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Verify that when an auxiliary registration exists on a Context Broker and an entity with the same ID exists both locally in the Context Broker and remotely in the Context Source with different attributes, a retrieval request to the Context Broker is correctly forwarded to the Context Source, and the response includes the local entity enriched with additional, non-conflicting attributes from the Context Source + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +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 *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${entity_payload_filename2} vehicle-simple-attributes-second.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${fragment_filename} vehicle-brandname-fragment.json +${expected_attribute} brandName + +*** Test Cases *** +D010_01_aux Retrieve entity that exists on both the Context Source and the Context Broker from the Context Broker + [Documentation] Check that if one retrieves entity living on on both the Context Broker and a Context Source, entities get merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + Set Stub Reply GET /ngsi-ld/v1/entities/${entity_id} 200 ${entity_body} + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing an Attribute set to ${expected_attribute} ${response.json()} ${entity_fragment} + Should Have Value In Json ${response.json()} $.isParked + Should Have Value In Json ${response.json()} $.isParked2 + + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename2} ${entity_id} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 08aa52b1bb21c9ad001f25152b11654f557325e5 Mon Sep 17 00:00:00 2001 From: Marco Cavalli Date: Tue, 20 May 2025 16:25:09 +0200 Subject: [PATCH 25/34] refactor statisticsDocumentationData.py for improved readability and consistency --- doc/statisticsDocumentationData.py | 94 +++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 27 deletions(-) diff --git a/doc/statisticsDocumentationData.py b/doc/statisticsDocumentationData.py index 3786cd9c2..1e680c45d 100644 --- a/doc/statisticsDocumentationData.py +++ b/doc/statisticsDocumentationData.py @@ -13,28 +13,39 @@ if __name__ == "__main__": number_of_all_testcases = 0 number_of_successes = 0 ROBOT_FILE_EXTENSION = ".robot" - BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" + BASE_URL_OF_FORGE = ( + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/" + ) fullpath = basedir + "/TP/NGSI-LD" - excluded_dirs = [''] + excluded_dirs = [""] for root, dirs, files in walk(fullpath): if root == fullpath: dirs[:] = [d for d in dirs if d not in excluded_dirs] for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 - name_of_test_case = filename[:-len(ROBOT_FILE_EXTENSION)] + name_of_test_case = filename[: -len(ROBOT_FILE_EXTENSION)] json_of_test_case = create_json_of_robotfile(name_of_test_case, True) statistics[name_of_test_case] = dict() - strippedpath = root[len(fullpath)+1:] + strippedpath = root[len(fullpath) + 1 :] statistics[name_of_test_case]["path"] = strippedpath - if "error_while_parsing" in json_of_test_case and json_of_test_case["error_while_parsing"]: + if ( + "error_while_parsing" in json_of_test_case + and json_of_test_case["error_while_parsing"] + ): statistics[name_of_test_case]["failed"] = True number_of_failures += 1 # we create a dummy entry in the "sub" test_cases, which has a "permutation_tp_id" equal to the # robotfile. We do not forget to add a trailing slash that will be removed later, and a tail _XX # which will allow matching from the googlesheet? - json_of_test_case["test_cases"] = [{"permutation_tp_id": "/"+json_of_test_case["robotfile"]+"_XX"}] + json_of_test_case["test_cases"] = [ + { + "permutation_tp_id": "/" + + json_of_test_case["robotfile"] + + "_XX" + } + ] else: statistics[name_of_test_case]["failed"] = False number_of_successes += 1 @@ -43,14 +54,17 @@ if __name__ == "__main__": # establish the right configuration if json_of_test_case["robotpath"].startswith("ContextSource"): json_of_test_case["config_id"] = "CF_05" - elif 'cf_06' in json_of_test_case["test_cases"][0]["tags"]: + elif "cf_06" in json_of_test_case["test_cases"][0]["tags"]: json_of_test_case["config_id"] = "CF_06" else: json_of_test_case["config_id"] = "CF_01" # upgrade the version and add the reference in square brackets - json_of_test_case["reference"] = ( - re.sub(r"V1.3.1 \[\]", "version 1.5.1 [1]", json_of_test_case["reference"])) + json_of_test_case["reference"] = re.sub( + r"V1\.[3-6]\.1 \[\]", + "V1.6.1 [1]", + json_of_test_case["reference"], + ) # now for each permutation inside this test case, create the permutation's correct parent_release if "test_cases" in json_of_test_case: @@ -59,13 +73,18 @@ if __name__ == "__main__": # default parent release parent_release = "v1.3.1" for tag in permutation_body["tags"]: - if tag.startswith('since_'): - parts = tag.split('_') + if tag.startswith("since_"): + parts = tag.split("_") # the suffix parent_release = parts[-1] - permutation_body["permutation_parent_release"] = parent_release + permutation_body["permutation_parent_release"] = ( + parent_release + ) else: - print("NO PERMUTATIONS in TESTCASE??? " + json_of_test_case["tp_id"]) + print( + "NO PERMUTATIONS in TESTCASE??? " + + json_of_test_case["tp_id"] + ) exit(1) testcases.append(json_of_test_case) print() @@ -74,14 +93,16 @@ if __name__ == "__main__": print("THE FOLLOWING TESTCASES FAILED PARSING:") for testcasename, testcaseresult in statistics.items(): if testcaseresult["failed"]: - print(testcasename+" "+testcaseresult["path"]) - - print(f"Out of {number_of_all_testcases} testcases, {number_of_failures} of them failed to be correctly parsed.") + print(testcasename + " " + testcaseresult["path"]) + + print( + f"Out of {number_of_all_testcases} testcases, {number_of_failures} of them failed to be correctly parsed." + ) testcases_file = join(basedir, "doc", "results", "testcases.json") - with open(testcases_file, 'w') as fp: + with open(testcases_file, "w") as fp: json.dump(obj=testcases, indent=2, fp=fp) - + # determine the structure/schema of a successfully parsed testcase permutation_template = {} for testcase in testcases: @@ -107,9 +128,13 @@ if __name__ == "__main__": # everything that is a permutation_body inside the "sub" test_cases, # shall rise on its own existenz and be joined with its permutation_metadata for permutation_body in testcase["test_cases"]: - permutation_body_template = {} # new object, not changing permutation_body + permutation_body_template = ( + {} + ) # new object, not changing permutation_body if "permutation_tp_id" in permutation_body: - permutation_body_template["stripped_permutation_tp_id"] = "UNKNOWN" + permutation_body_template["stripped_permutation_tp_id"] = ( + "UNKNOWN" + ) permutation_body_template["robotlink"] = "UNKNOWN" for key, value in permutation_body.items(): if type(key) is str: @@ -126,7 +151,10 @@ if __name__ == "__main__": print("UNKNOWN BODY type") exit(1) # we use the unpacking python operator ** that strips the container dict from both - permutation_template = {**permutation_metadata_template, **permutation_body_template} + permutation_template = { + **permutation_metadata_template, + **permutation_body_template, + } else: print("NO PERMUTATION TP ID") exit(1) @@ -135,7 +163,7 @@ if __name__ == "__main__": exit(1) if permutation_template != {}: break - + print() print("Typical template:") print(permutation_template) @@ -152,8 +180,13 @@ if __name__ == "__main__": permutation_metadata[key] = value # start creating HTML link to robot file in repo - fullurl = (BASE_URL_OF_FORGE + permutation_metadata["robotpath"] + - "/" + permutation_metadata["robotfile"] + ROBOT_FILE_EXTENSION) + fullurl = ( + BASE_URL_OF_FORGE + + permutation_metadata["robotpath"] + + "/" + + permutation_metadata["robotfile"] + + ROBOT_FILE_EXTENSION + ) if "test_cases" in testcase: # everything that is a permutation_body inside the "sub" test_cases, @@ -168,11 +201,18 @@ if __name__ == "__main__": # print("::: "+ptpid) # strip from beginning up to including the last "/" - permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:] + permutation_body["stripped_permutation_tp_id"] = ptpid[ + ptpid.rindex("/") + 1 : + ] # use the stripped_permutation_tp_id as text of the link permutation_body["robotlink"] = ( - "" + permutation_body["stripped_permutation_tp_id"] + "") + '' + + permutation_body["stripped_permutation_tp_id"] + + "" + ) # So basically we append to the permutations a new dict that is the | union merge of the # items of the template merged with the items of the concatenation of {**permutation_metadata, @@ -199,5 +239,5 @@ if __name__ == "__main__": exit(1) permutations_file = join(basedir, "doc", "results", "permutations.json") - with open(permutations_file, 'w') as fp: + with open(permutations_file, "w") as fp: json.dump(obj=permutations, indent=2, fp=fp) -- GitLab From edf13e580b7e731cb328ebee76b4f6386c52efc7 Mon Sep 17 00:00:00 2001 From: Marco Cavalli Date: Tue, 20 May 2025 17:04:05 +0200 Subject: [PATCH 26/34] refactor generateDocumentationData.py for improved readability and structure --- doc/generateDocumentationData.py | 40 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/generateDocumentationData.py b/doc/generateDocumentationData.py index b4451d382..f82decb69 100644 --- a/doc/generateDocumentationData.py +++ b/doc/generateDocumentationData.py @@ -5,16 +5,19 @@ from os.path import dirname, exists from os import makedirs, walk -def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: bool=False): +def create_json_of_robotfile( + robot_file_to_be_processed: str, computestatistics: bool = False +): # TODO: ApiUtils.resource -> 'Delete Context Source Registration Subscription' added 'url=' as parameter - folder_test_suites = dirname(dirname(__file__)).replace('\\', "/") - folder_result_path = f'{folder_test_suites}/doc/results' - result_file = f'{folder_result_path}/{robot_file_to_be_processed}.json' - robot_path_to_be_processed, robot_file = find_robot_file(basedir=folder_test_suites, - filename=robot_file_to_be_processed) + folder_test_suites = dirname(dirname(__file__)).replace("\\", "/") + folder_result_path = f"{folder_test_suites}/doc/results" + result_file = f"{folder_result_path}/{robot_file_to_be_processed}.json" + robot_path_to_be_processed, robot_file = find_robot_file( + basedir=folder_test_suites, filename=robot_file_to_be_processed + ) if robot_path_to_be_processed is None and robot_file is None: - print(f'No robot file found with name: {robot_file_to_be_processed}') + print(f"No robot file found with name: {robot_file_to_be_processed}") exit(1) # Check that the folder '/results' exists and if not, create it @@ -33,7 +36,7 @@ def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: info["error_while_parsing"] = True info["error_while_autogenerating"] = str(e) info["robotfile"] = robot_file_to_be_processed - if(robot_path_to_be_processed.startswith("/")): + if robot_path_to_be_processed.startswith("/"): robot_path_to_be_processed = robot_path_to_be_processed[1:] info["robotpath"] = robot_path_to_be_processed else: @@ -41,17 +44,17 @@ def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: data.parse_robot() info = data.get_info() - with open(result_file, 'w') as fp: + with open(result_file, "w") as fp: dump(obj=info, indent=2, fp=fp) return info def find_robot_file(basedir: str, filename: str): - filename = f'{filename}.robot' + filename = f"{filename}.robot" for root, dirs, files in walk(basedir): if filename in files: - return root.replace(f'{basedir}/TP/NGSI-LD', ''), f'{root}/{filename}' + return root.replace(f"{basedir}/TP/NGSI-LD", ""), f"{root}/{filename}" return None, None @@ -59,7 +62,18 @@ def find_robot_file(basedir: str, filename: str): if __name__ == "__main__": # Call with the folder below /TP/NGSI-LD which contains the robot file with name args[0] args = argv[1:] - robot_file_tbp = args[0] - resulting_json = create_json_of_robotfile(robot_file_tbp) + if len(args) == 0: + tp_root_name = dirname(dirname(__file__)).replace("\\", "/") + robot_file_tbp = f"{tp_root_name}/TP/NGSI-LD/" + robot_file_tbp = robot_file_tbp.replace("\\", "/") + for root, dirs, files in walk(robot_file_tbp): + for file in files: + if file.endswith(".robot"): + filename = file.replace(".robot", "") + print(f"Generating json for {filename}") + create_json_of_robotfile(filename, computestatistics=True) + else: + robot_file_tbp = args[0] + resulting_json = create_json_of_robotfile(robot_file_tbp) print("\nCorrectly exiting") -- GitLab From ae6e46da6549c31f14ab29e0f6ce0a5dc26b3d3c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Tue, 20 May 2025 14:52:20 +0200 Subject: [PATCH 27/34] chore: apply Robotidy to all Robot files --- .../Consumption/Entity/QueryEntities/D011_01_03_inc.robot | 1 - .../Consumption/Entity/RetrieveEntity/D010_01_inc.robot | 1 - .../Provision/Entities/CreateEntity/D001_03_02_inc.robot | 1 - .../Provision/Entities/DeleteEntity/D002_02_02_inc.robot | 1 - .../UpdateEntityAttributes/D004_01_inc.robot | 1 - resources/ApiUtils/ContextInformationConsumption.resource | 7 ++++++- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot index c2d07a34e..533c80622 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot @@ -20,7 +20,6 @@ ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-entities.jsonld - *** Test Cases *** D011_01_03_inc Query The Context Broker With Type and Attribute [Documentation] Check that if one queries for attribute present in an entity on a Context Source, only that entity gets returned diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot index 755265dce..d4932d876 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_inc.robot @@ -29,7 +29,6 @@ D010_01_inc Retrieve entity on a Context Source from the Context Broker Check Response Status Code 200 ${response.status_code} - *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot index b91322963..330000fd3 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_03_02_inc.robot @@ -32,7 +32,6 @@ D001_03_02_inc Create entity already existing on both Context Broker and Context Check JSON Value In Response Body ['status'] 409 ${response.json()['errors'][1]['error']} - *** Keywords *** Create Entity And Registration On The Context Broker And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot index 85a1ff04a..916a11a3a 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_02_inc.robot @@ -33,7 +33,6 @@ D002_02_02_inc Delete Entity On a Context Source Should Be Equal As Integers ${length} 1 - *** Keywords *** Setup Registration And Start Context Source Mock Server ${entity_id}= Generate Random Entity Id ${entity_id_prefix} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot index dba120eb1..d834fe8b2 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_inc.robot @@ -21,7 +21,6 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi ${fragment_filename} vehicle-brandname-complete-fragment.jsonld - *** Test Cases *** D004_01_inc Query The Context Broker With Type [Documentation] Check that if one request the Context Broker to update an entity that matches an inclusive registration, this is updated on the Context Source too diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 1aecf15bb..7b3041248 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -210,7 +210,12 @@ Retrieve Attributes RETURN ${response} Retrieve Entity by Id - [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${local}=${EMPTY} ${options}=${EMPTY} + [Arguments] + ... ${id} + ... ${accept}=${CONTENT_TYPE_LD_JSON} + ... ${context}=${EMPTY} + ... ${local}=${EMPTY} + ... ${options}=${EMPTY} ${headers}= Create Dictionary &{params}= Create Dictionary ${options_length}= Get Length ${options} -- GitLab From fd3fc8b127ebc8f14d628bd4aa429d0fc115f861 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Thu, 12 Jun 2025 12:22:25 +0200 Subject: [PATCH 28/34] Refactor: Remove unused data files and update test cases --- .../Entity/QueryEntities/D011_01_aux.robot | 3 ++- .../Entity/RetrieveEntity/D010_01_aux.robot | 3 ++- .../Entities/CreateEntity/D001_02_inc.robot | 2 +- ...stration-vehicle-complete-auxiliary.jsonld | 18 -------------- ...istration-vehicle-complete-redirect.jsonld | 24 ------------------- ...ource-registration-vehicle-complete.jsonld | 6 ----- 6 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld delete mode 100644 data/csourceRegistrations/context-source-registration-vehicle-complete-redirect.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot index 400bb4839..ce15c1ee4 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot @@ -17,7 +17,7 @@ ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${entity_payload_filename} vehicle-simple-attributes.json ${entity_payload_filename2} vehicle-simple-attributes-second.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld ${fragment_filename} vehicle-brandname-fragment.json ${expected_attribute} brandName @@ -49,6 +49,7 @@ 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} + ... mode=auxiliary ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot index 0d9743e64..971661e92 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot @@ -17,7 +17,7 @@ ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${entity_payload_filename} vehicle-simple-attributes.json ${entity_payload_filename2} vehicle-simple-attributes-second.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld ${fragment_filename} vehicle-brandname-fragment.json ${expected_attribute} brandName @@ -49,6 +49,7 @@ 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} + ... mode=auxiliary ${response1}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response1.status_code} Start Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot index f834d9b98..f0b908eff 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_inc.robot @@ -28,7 +28,7 @@ D001_02_inc Request to create an entity with a malformed id on both Context Brok ${response}= Create Entity ${entity_payload_filename} ${entity_id} Check Response Status Code 400 ${response.status_code} - Wait For No Request timeout=5 + Wait For No Request ${response_query}= Query Entities entity_types=Vehicle local=true context=${ngsild_test_suite_context} Check Response Status Code 200 ${response_query.status_code} Should Be Empty ${response_query.json()} diff --git a/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld deleted file mode 100644 index 2967d8864..000000000 --- a/data/csourceRegistrations/context-source-registration-vehicle-complete-auxiliary.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", - "type": "ContextSourceRegistration", - "information": [ - { - "entities": [ - { - "type": "Vehicle" - } - ] - } - ], - "endpoint": "http://my.csource.org:1026", - "mode": "auxiliary", - "@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/context-source-registration-vehicle-complete-redirect.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-complete-redirect.jsonld deleted file mode 100644 index c4f67054b..000000000 --- a/data/csourceRegistrations/context-source-registration-vehicle-complete-redirect.jsonld +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", - "type": "ContextSourceRegistration", - "information": [ - { - "entities": [ - { - "type": "Vehicle" - } - ], - "propertyNames": [ - "brandName" - ], - "relationshipNames": [ - "isParked" - ] - } - ], - "endpoint": "http://my.csource.org:1026", - "mode": "redirect", - "@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/context-source-registration-vehicle-complete.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-complete.jsonld index 2c2d5b084..e608440d4 100644 --- a/data/csourceRegistrations/context-source-registration-vehicle-complete.jsonld +++ b/data/csourceRegistrations/context-source-registration-vehicle-complete.jsonld @@ -7,12 +7,6 @@ { "type": "Vehicle" } - ], - "propertyNames": [ - "brandName" - ], - "relationshipNames": [ - "isParked" ] } ], -- GitLab From c68d8614cfa794e54ff738dfd580dad6a7cf36c8 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Thu, 12 Jun 2025 12:24:29 +0200 Subject: [PATCH 29/34] feat: added 'mode' parameter to registration_payload --- resources/ApiUtils/ContextSourceRegistration.resource | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index b8737ba53..7d92154ab 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -22,7 +22,7 @@ ${context_source_url} http://${context_source_host}:${ *** Keywords *** Prepare Context Source Registration From File - [Arguments] ${id} ${registration_file} ${entity_id}=${EMPTY} ${mode}=${EMPTY} ${endpoint}=${EMPTY} + [Arguments] ${id} ${registration_file} ${entity_id}=${EMPTY} ${mode}=${EMPTY} ${endpoint}=${EMPTY} ${operations}=[] ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${registration_payload}= Update Value To JSON @@ -47,6 +47,13 @@ Prepare Context Source Registration From File ... $ ... ${dict} END + IF ${operations} + ${dict}= Create Dictionary operations=${operations} + ${registration_payload}= Add Object To JSON + ... ${registration_payload} + ... $ + ... ${dict} + END RETURN ${registration_payload} Create Context Source Registration -- GitLab From ab84fa8023adc61684b9eb8bf2faf46bf242b678 Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Thu, 19 Jun 2025 12:36:52 +0200 Subject: [PATCH 30/34] added new test cases with local flag --- .../Entities/CreateEntity/D001_04_inc.robot | 51 +++++++++++++++++++ .../Entities/DeleteEntity/D002_03_inc.robot | 49 ++++++++++++++++++ .../ContextInformationProvision.resource | 10 +++- 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_04_inc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_03_inc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_04_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_04_inc.robot new file mode 100644 index 000000000..48c411139 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_04_inc.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Verify that when an entity creation request is made to the Context Broker with the local parameter, the request is not forwarded to the Context Source, and the entity is created only on the Context Broker + + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Suite 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 *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D001_04_inc Create Entity With Local Flag + [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to create an entity with local flag and the operation should not be forwarded to the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_1 6_3_18 + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=true + Check Response Status Code 201 ${response.status_code} + + Wait For No Request + +*** Keywords *** +Setup Entity Id And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + Set Suite Variable ${entity_id} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_03_inc.robot new file mode 100644 index 000000000..d33d88ee1 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_03_inc.robot @@ -0,0 +1,49 @@ +*** Settings *** + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Suite Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Suite Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D002_03_inc Delete Entity With Local Flag + [Documentation] Verify that, when one has an inclusive registration on a Context Broker, one is able to delete an entity with local flag and the operation should not be forwarded to the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_6_6 6_3_18 + ${response}= Delete Entity by Id ${entity_id} local=true + Check Response Status Code 204 ${response.status_code} + + Wait For No Request + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + 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 Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index 41d3a7c06..2a7400b7b 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -151,13 +151,16 @@ Batch Upsert Entities RETURN ${response} Create Entity - [Arguments] ${filename} ${entity_id} + [Arguments] ${filename} ${entity_id} ${local}=${EMPTY} + &{params}= Create Dictionary + IF '${local}'!='' Set To Dictionary ${params} local=${local} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} ... json=${entity} + ... params=${params} ... headers=${headers} ... expected_status=any Output ${response} Create Entity @@ -238,9 +241,12 @@ Delete Entity Attributes RETURN ${response} Delete Entity by Id - [Arguments] ${id} + [Arguments] ${id} ${local}=${EMPTY} + &{params}= Create Dictionary + IF '${local}'!='' Set To Dictionary ${params} local=${local} ${response}= DELETE ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} + ... params=${params} ... expected_status=any IF ${delete_temporal_on_core_delete} Delete Temporal Representation Of Entity ${id} -- GitLab From 5860f7fe25080ebaca578cd0b485ebf2321aedef Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Thu, 19 Jun 2025 12:39:35 +0200 Subject: [PATCH 31/34] added new test cases limiting distribution operations with a specific operation --- .../Entity/QueryEntities/D011_03_inc.robot | 62 +++++++++++++++++ .../Entity/QueryEntities/D011_04_inc.robot | 65 +++++++++++++++++ .../Entity/RetrieveEntity/D010_03_inc.robot | 69 +++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_inc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_04_inc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_inc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_inc.robot new file mode 100644 index 000000000..4b424bf5f --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_03_inc.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the request gets forwarded to the Context Source correctly using the appropriate operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + +*** Test Cases *** +D011_03_01_inc Query The Context Broker By Id using the queryEntity operation + [Documentation] Check that if one queries the Context Broker for type, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type + queryEntity GET /ngsi-ld/v1/entities?type=Vehicle + +D011_03_02_inc Query The Context Broker By Id using the queryBatch operation + [Documentation] Check that if one queries the Context Broker for type, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type + queryBatch POST /ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Query The Context Broker With Type + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${operations}= Create List ${operation} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... operations=${operations} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_body} + @{entities_id}= Create List ${entity_id} + ${response}= Query Entities entity_ids=${entities_id} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_04_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_04_inc.robot new file mode 100644 index 000000000..aff7cc1a7 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_04_inc.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker Via Post the request gets forwarded to the Context Source correctly using the appropriate operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + +*** Test Cases *** +D011_04_01_inc Query The Context Broker By Id Via POST using the queryBatch operation + [Documentation] Check that if one queries the Context Broker for type via POST, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryBatch POST /ngsi-ld/v1/entityOperations/query + +D011_04_02_inc Query The Context Broker By Id Via POST using the queryEntity operation + [Documentation] Check that if one queries the Context Broker for type via POST, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryEntity GET /ngsi-ld/v1/entities?type=Vehicle + +*** Keywords *** +Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${operations}= Create List ${operation} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... operations=${operations} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_body} + &{entities}= Create Dictionary + Set To Dictionary ${entities} id=${entity_id} + @{entities}= Create List ${entities} + ${response}= Query Entities Via POST entities=${entities} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + @{entities_id}= Create List ${entity_id} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_inc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_inc.robot new file mode 100644 index 000000000..de7bf5494 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_inc.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Verify that, when one has an inclusive registration on a Context Broker and an entity only on a Context Source, a retrieval request to the Context Broker the request is forwarded correcty to the Context Source using the appropriate operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Retrieve Entity +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-complete.jsonld + +*** Test Cases *** +D010_03_01_inc Retrieve Entity By Id using the retrieveEntity operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the retrieveEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + retrieveEntity GET /ngsi-ld/v1/entities/ + +D010_03_02_inc Retrieve Entity By Id using the queryEntity operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + queryEntity GET /ngsi-ld/v1/entities?type=Vehicle +D010_03_03_inc Retrieve Entity By Id using the queryBatch operation + [Documentation] Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + [Template] Setup Registration, Context Source Mock Server And Retrieve Entity + queryBatch POST /ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Retrieve Entity + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Entity Id ${entity_id_prefix} + + IF '${operation}' == 'retrieveEntity' + ${url}= Set Variable ${url}${entity_id} + END + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${operations}= Create List ${operation} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... operations=${operations} + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + + ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_body} + ${response}= Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 53fcb73af1427816eefeb511a7a797b2e64c086c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 26 Jun 2025 10:50:06 +0200 Subject: [PATCH 32/34] fix(019_07): replace must by shall --- .../Consumption/Entity/QueryEntities/019_07.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index 60a53e038..c9bfe981a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. +Documentation If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it shall contain the total number of matching results. Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -30,7 +30,7 @@ ${airQualityLevel}= airQualityLevel==6 *** Keywords *** Query Entities With Count - [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. + [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it shall contain the total number of matching results. [Arguments] ${q} ${expected_status_code} ${expected_count} ${response}= Query Entities ... entity_types=${entity_type} -- GitLab From 6faadc574c5d882268c3455fa154123c8cdc40fb Mon Sep 17 00:00:00 2001 From: Andrea Il Grande Date: Wed, 2 Jul 2025 13:03:16 +0200 Subject: [PATCH 33/34] fixed tags in auxiliary test cases --- .../Consumption/Entity/QueryEntities/D011_01_aux.robot | 2 +- .../Consumption/Entity/RetrieveEntity/D010_01_aux.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot index 86337cbad..1940e0ed0 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_aux.robot @@ -26,7 +26,7 @@ ${expected_attribute} brandName *** Test Cases *** D011_01_aux Query entities that exists on both the Context Source and the Context Broker from the Context Broker [Documentation] Check that if one queries the Context Broker for type, entities get merged correctly - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-auxiliary 4_3_6_2 5_7_1 ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} Set Stub Reply GET /ngsi-ld/v1/entities?type=Vehicle 200 ${entity_body} diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot index 40485f93e..1339a0a34 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot @@ -26,7 +26,7 @@ ${expected_attribute} brandName *** Test Cases *** D010_01_aux Retrieve entity that exists on both the Context Source and the Context Broker from the Context Broker [Documentation] Check that if one retrieves entity living on on both the Context Broker and a Context Source, entities get merged correctly - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-inclusive 4_3_6_2 5_7_1 + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 additive-auxiliary 4_3_6_2 5_7_1 ${entity_body}= Load Entity ${entity_payload_filename} ${entity_id} ${entity_fragment}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} Set Stub Reply GET /ngsi-ld/v1/entities/${entity_id} 200 ${entity_body} -- GitLab From 995aeb747337f66aa811d313c9b1a8fcc705f4b6 Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Wed, 2 Jul 2025 13:04:53 +0200 Subject: [PATCH 34/34] fix: missing 033_01.json --- .../ContextSource/Registration/033_01.json | 87 +++++++++++++++++++ .../ContextSource/Registration/033_01_01.json | 37 -------- .../ContextSource/Registration/033_01_02.json | 37 -------- .../ContextSource/Registration/033_01_03.json | 37 -------- doc/tests/test_ContextSource_Registration.py | 22 +---- 5 files changed, 91 insertions(+), 129 deletions(-) create mode 100644 doc/files/ContextSource/Registration/033_01.json delete mode 100644 doc/files/ContextSource/Registration/033_01_01.json delete mode 100644 doc/files/ContextSource/Registration/033_01_02.json delete mode 100644 doc/files/ContextSource/Registration/033_01_03.json diff --git a/doc/files/ContextSource/Registration/033_01.json b/doc/files/ContextSource/Registration/033_01.json new file mode 100644 index 000000000..fb9cfdc99 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_01.json @@ -0,0 +1,87 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_01", + "test_objective": "Check that one can create a context source registration with specific ID and expiration date", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [ + "Create Context Source Registration", + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_01_01 Create Context Source Registration Without Mode And Operation", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_01", + "doc": "Check that one can create a context source registration with specific ID and expiration date", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 201 and\n Delete Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Create Context Source Registration with payload set to '${registration_payload}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "033_01_02 Create Context Source Registration With Non Default Mode And Operations", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_02", + "doc": "Check that one can create a context source registration with specific ID and expiration date", + "tags": [ + "5_9_2", + "csr-create", + "since_v1.6.1" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 201 and\n Delete Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Create Context Source Registration with payload set to '${registration_payload}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "033_01_03 Create Context Source Registration With Location", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_03", + "doc": "Check that one can create a context source registration with specific ID and expiration date", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 201 and\n Delete Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Create Context Source Registration with payload set to '${registration_payload}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "033_01_04 Create Context Source Registration With Specific Date Expiration Date", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_04", + "doc": "Check that one can create a context source registration with specific ID and expiration date", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 201 and\n Delete Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Create Context Source Registration with payload set to '${registration_payload}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_01.json b/doc/files/ContextSource/Registration/033_01_01.json deleted file mode 100644 index 053574567..000000000 --- a/doc/files/ContextSource/Registration/033_01_01.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/CS/CSR/033_01_01", - "test_objective": "Check that you can create a context source registration with specific ID and expiration date", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", - "config_id": "", - "parent_release": "v1.3.1", - "clauses": [ - "5.9.2" - ], - "pics_selection": "", - "keywords": [ - "Delete Created Context Source Registrations" - ], - "teardown": "Delete Created Context Source Registrations", - "initial_condition": "with {\n the SUT containing an initial state\n}", - "test_cases": [ - { - "name": "033_01_01 Create Context Source Registration With Specific Date Expiration Date", - "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_01", - "doc": "Check that you can create a context source registration with specific ID and expiration date", - "tags": [ - "5_9_2", - "csr-create" - ], - "setup": null, - "teardown": null, - "template": null, - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${registration_payload}'\n}", - "http_verb": "POST", - "endpoint": "csourceRegistrations" - } - ], - "permutations": [], - "robotpath": "ContextSource/Registration/RegisterContextSource", - "robotfile": "033_01_01" -} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_02.json b/doc/files/ContextSource/Registration/033_01_02.json deleted file mode 100644 index e00e09939..000000000 --- a/doc/files/ContextSource/Registration/033_01_02.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/CS/CSR/033_01_02", - "test_objective": "Check that you can create a context source registration that never expires", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", - "config_id": "", - "parent_release": "v1.3.1", - "clauses": [ - "5.9.2" - ], - "pics_selection": "", - "keywords": [ - "Delete Created Context Source Registrations" - ], - "teardown": "Delete Created Context Source Registrations", - "initial_condition": "with {\n the SUT containing an initial state\n}", - "test_cases": [ - { - "name": "033_01_02 Create Context Source Registration That Never Expires", - "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_02", - "doc": "Check that you can create a context source registration that never expires", - "tags": [ - "5_9_2", - "csr-create" - ], - "setup": null, - "teardown": null, - "template": null, - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Create Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${registration_payload}'\n}", - "http_verb": "POST", - "endpoint": "csourceRegistrations" - } - ], - "permutations": [], - "robotpath": "ContextSource/Registration/RegisterContextSource", - "robotfile": "033_01_02" -} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_03.json b/doc/files/ContextSource/Registration/033_01_03.json deleted file mode 100644 index ea4a3ea25..000000000 --- a/doc/files/ContextSource/Registration/033_01_03.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/CS/CSR/033_01_03", - "test_objective": "Check that you can create a context source registration without specifying an ID", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", - "config_id": "", - "parent_release": "v1.3.1", - "clauses": [ - "5.9.2" - ], - "pics_selection": "", - "keywords": [ - "Delete Created Context Source Registrations" - ], - "teardown": "Delete Created Context Source Registrations", - "initial_condition": "with {\n the SUT containing an initial state\n}", - "test_cases": [ - { - "name": "033_01_03 Create Context Source Registration Without Specifying an ID", - "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_03", - "doc": "Check that you can create a context source registration without specifying an ID", - "tags": [ - "5_9_2", - "csr-create" - ], - "setup": null, - "teardown": null, - "template": null, - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${payload}'\n}", - "http_verb": "POST", - "endpoint": "csourceRegistrations" - } - ], - "permutations": [], - "robotpath": "ContextSource/Registration/RegisterContextSource", - "robotfile": "033_01_03" -} \ No newline at end of file diff --git a/doc/tests/test_ContextSource_Registration.py b/doc/tests/test_ContextSource_Registration.py index 3a9ddef3e..4c8b7f91d 100644 --- a/doc/tests/test_ContextSource_Registration.py +++ b/doc/tests/test_ContextSource_Registration.py @@ -42,24 +42,10 @@ class TestCSRegistration(TestCase): assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' - def test_033_01_01(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_01.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_01.json' - - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - - def test_033_01_02(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_02.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_02.json' - - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - - def test_033_01_03(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_03.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_03.json' + def test_033_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_01.json' self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) -- GitLab