diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot index a9d3a691eaf2530d62a1c1afebbb9670064c8145..47a71624048714d6edc675cec49555803a6c6e6d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -17,9 +17,9 @@ Test Template Create Entity With Invalid Request Scenarios 001_02_03 EntityWithNoContext [Tags] e-create 5_6_1 building-minimal.json ${ERROR_TYPE_BAD_REQUEST_DATA} -001_02_04 EntityWithNoContext +001_02_04 EntityWithInvalidType [Tags] e-create 5_6_1 - invalid-type.jsonld ${ERROR_TYPE_INVALID_REQUEST} + invalid-type.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot index acd4e36cc07691cde055a4eb61bc25d0e7b43730..6ff061b98fa75303eda3d11f075f189b72944121 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot @@ -31,7 +31,7 @@ ${building_filename}= building-location-attribute.jsonld Should be Equal ${subscription_id} ${notification}[subscriptionId] Length Should Be ${notification}[data] ${1} ${notified_entity}= Set Variable ${notification}[data][0] - Length Should Be ${notified_entity} ${4} + Length Should Be ${notified_entity} ${5} Should be Equal ${entity_id} ${notified_entity}[id] Should Have Value In Json ... json_object=${notified_entity} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..048cec172e143a505f6d504c1638c8b5de162203 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Verify that an entity can be created exclusively on a Context Source, the entity shall be retrieved correctly. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D001_01_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is created correctly on both the Context Broker and the Context Source. The entity shall be retrieved correctly. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + Set Stub Reply POST /broker1/ngsi-ld/v1/entities 201 + ${speed_entity}= Create Entity ${entity_speed_filename} ${entity_id} + Check Response Status Code 201 ${speed_entity.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..a6a21cd31fb0dbe697e116b70932d9946fc52aae --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Verify that a registration made without the correct operations cannot create an entity on a Context Source and shall raise an error. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld +*** Test Cases *** +D001_02_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity cannot be created in the Context Source. The creation shall raise a conflict error. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities 404 + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities + Should Be True ${stub_count} == 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..5a1cf41359623e97a79629cb2a1b10fba6619a59 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Verify that an entity can be deleted on the Context Source and the Context Broker by using an exclusive registration which supports all operations. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D002_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is deleted correctly in the Context Sources. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + + Set Stub Reply DELETE /broker1/ngsi-ld/v1/entities/${entity_id} 204 + ${response}= Delete Entity by Id ${entity_id} + Check Response Status Code 204 ${response.status_code} + ${stub_count}= Get Stub Count DELETE /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..24fc8af0e3cb23f003cc710d7d1796a62186e302 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Verify that an entity cannot be deleted on the Context Source if the registration does not support the correct operations. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld + +*** Test Cases *** +D002_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is deleted correctly in the Context Sources. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + + Set Stub Reply DELETE /broker1/ngsi-ld/v1/entities/${entity_id} 404 + ${stub_count}= Get Stub Count DELETE /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} == 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..dd50dae85cf08b959f6f623d224d92c1296ee572 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot @@ -0,0 +1,64 @@ +*** Settings *** +Documentation Verify that an entity on the Context Source can be updated correctly. The whole entity shall have the new attribute. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${entity_newSpeed_filename} vehicle-speed-different-attribute.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D004_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is updated correctly in the Context Sources. It shall be retrieved correctly with the updated attributes. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${entity_newSpeed_filename} + ... ${CONTENT_TYPE_LD_JSON} + ${response}= Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..f325fae3e27f209c5181b9a71cdadabcacab409e --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld @@ -0,0 +1,19 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + } + ], + "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-vehicle-speed.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b1798060b56ef16a88b88829b549d2cad3f63e69 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps"], + "endpoint": "http://my.csource.org:1026/", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..dc6f3b8025e6dd878202b0c2483a08b05c2e043a --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 66, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/vehicle-speed-attribute.json b/data/entities/vehicle-speed-attribute.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a2fdc03d0550292b920280ac7b0d5f0c556872 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.json @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + } + } +} \ No newline at end of file diff --git a/data/entities/vehicle-speed-attribute.jsonld b/data/entities/vehicle-speed-attribute.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7462308062d285ff87c0f12443638ed30d202b39 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld index 88d10bcb0844accc8e20368b6c26190217ad39eb..ba572931713a212efefd3b5df4bccb08b74e53e0 100644 --- a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld +++ b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld @@ -1,6 +1,6 @@ { "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld" ] }