diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_exc.robot new file mode 100644 index 0000000000000000000000000000000000000000..46d5fcf08b739f8b1f54879c162ee5a4c9654e3e --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_exc.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that one can create a batch of entities on both Context Source and Context Broker thanks to a exclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_payload_filename} vehicle-speed-attribute.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld + +*** Test Cases *** +D012_01_exc Batch Create Entities With Exclusive Registration + [Documentation] Check that if one requests the Context Broker to create a batch of entities that match an exclusive registration, these are created on the Context Source too + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_7 + + ${speed_entity1}= Load Entity ${entity_speed_payload_filename} ${entity_id1} + ${speed_entity2}= Load Entity ${entity_speed_payload_filename} ${entity_id2} + @{entities_to_be_created}= Create List ${speed_entity1} ${speed_entity2} + @{expected_entities_ids}= Create List ${entity_id1} ${entity_id2} + Set Suite Variable @{entities_to_be_created} + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/create 201 + ${response}= Batch Create Entities + ... @{entities_to_be_created} + Check Response Status Code 201 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/create + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id1} local=true + Check Response Status Code 201 ${response.status_code} + ${response}= Create Entity ${entity_payload_filename} ${entity_id2} 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=${EMPTY} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_inc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_inc.robot new file mode 100644 index 0000000000000000000000000000000000000000..138fbf2fd1baee6a2403ff50cfc6c4edc91d1146 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_inc.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation Check that one can create a batch of entities on both Context Source and Context Broker thanks to a inclusive registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Entity And Registration On The Context Broker And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D012_01_inc Batch Create Entities With Inclusive Registration + [Documentation] Check that if one requests the Context Broker to create a batch of entities that match an inclusive registration, these are 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_7 + + Set Stub Reply POST /ngsi-ld/v1/entityOperations/create 201 + ${response}= Batch Create Entities + ... @{entities_to_be_created} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to @{expected_entities_ids} ${response.json()} + + ${entities_to_be_queried}= Catenate SEPARATOR=, ${entity_id1} ${entity_id2} + ${response1}= Query Entities + ... entity_ids=${entities_to_be_queried} + ... entity_types=Vehicle + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Created Resources Set To + ... expected_resources=${entities_to_be_created} + ... response_body=${response1.json()} + +*** Keywords *** +Create Entity And Registration On The Context Broker And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${entity1}= Load Entity ${entity_payload_filename} ${entity_id1} + ${entity2}= Load Entity ${entity_payload_filename} ${entity_id2} + + @{entities_to_be_created}= Create List ${entity1} ${entity2} + @{expected_entities_ids}= Create List ${entity_id1} ${entity_id2} + Set Suite Variable @{entities_to_be_created} + Set Suite Variable @{expected_entities_ids} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${EMPTY} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} + Delete Context Source Registration ${registration_id} + Stop Context Source Mock Server diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_red.robot new file mode 100644 index 0000000000000000000000000000000000000000..b32ab79e8bc05ba9ee5dcd594a9315f5bf88870b --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchEntities/D012_01_red.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation Check that one can create a batch of entities on the both Context Source thanks to a redirect registration + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Setup Entity Id And Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld + +*** Test Cases *** +D012_01_red Batch Create Entities With Redirect Registration + [Documentation] Check that if one requests the Context Broker to create a batch of entities that match a redirect registration, these are created on the Context Source + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-exclusive 4_3_6_3 5_6_7 + + ${entity1}= Load Entity ${entity_speed_payload_filename} ${entity_id1} + ${entity2}= Load Entity ${entity_speed_payload_filename} ${entity_id2} + @{entities_to_be_created}= Create List ${entity1} ${entity2} + Set Suite Variable @{entities_to_be_created} + + Set Stub Reply POST /broker1/ngsi-ld/v1/entityOperations/create 201 + Set Stub Reply POST /broker2/ngsi-ld/v1/entityOperations/create 201 + ${response}= Batch Create Entities + ... @{entities_to_be_created} + Check Response Status Code 201 ${response.status_code} + + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/create + Should Be Equal ${stub_count} 1 + ${stub_count}= Get Stub Count POST /broker2/ngsi-ld/v1/entityOperations/create + Should Be Equal ${stub_count} 1 + +*** Keywords *** +Setup Entity Id And Registration And Start Context Source Mock Server + ${entity_id1}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id1} + ${entity_id2}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id2} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${EMPTY} + ... mode=redirect + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + ${registration_id2}= Generate Random CSR Id + Set Suite Variable ${registration_id2} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id2} + ... ${registration_payload_file_path} + ... entity_id=${EMPTY} + ... mode=redirect + ... endpoint=/broker2 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} + Delete Context Source Registration ${registration_id} + Delete Context Source Registration ${registration_id2} + Stop Context Source Mock Server diff --git a/doc/files/DistributedOperations/Provision/D012_01_exc.json b/doc/files/DistributedOperations/Provision/D012_01_exc.json new file mode 100644 index 0000000000000000000000000000000000000000..d495eaa4d405d1d17dd8e58c402f204e497f5ff3 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D012_01_exc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_exc", + "test_objective": "Check that one can create a batch of entities on both Context Source and Context Broker thanks to a exclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.7", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.7" + ], + "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": "D012_01_exc Batch Create Entities With Exclusive Registration", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_exc", + "doc": "Check that if one requests the Context Broker to create a batch of entities that match an exclusive registration, these are created on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_7", + "cf_06", + "dist-ops", + "proxy-exclusive", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/CreateBatchEntities", + "robotfile": "D012_01_exc" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D012_01_inc.json b/doc/files/DistributedOperations/Provision/D012_01_inc.json new file mode 100644 index 0000000000000000000000000000000000000000..2f6ec3375c16188f5381880b5d2c0677b4a20254 --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D012_01_inc.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_inc", + "test_objective": "Check that one can create a batch of entities on both Context Source and Context Broker thanks to a inclusive registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.2, 5.6.7", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.2", + "5.6.7" + ], + "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": "D012_01_inc Batch Create Entities With Inclusive Registration", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_inc", + "doc": "Check that if one requests the Context Broker to create a batch of entities that match an inclusive registration, these are created on the Context Source too", + "tags": [ + "4_3_3", + "4_3_6_2", + "5_6_7", + "additive-inclusive", + "cf_06", + "dist-ops", + "since_v1.6.1" + ], + "setup": "Create Entity And Registration On The Context Broker And Start Context Source Mock Server", + "teardown": "Delete Created Entity And Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/CreateBatchEntities", + "robotfile": "D012_01_inc" +} \ No newline at end of file diff --git a/doc/files/DistributedOperations/Provision/D012_01_red.json b/doc/files/DistributedOperations/Provision/D012_01_red.json new file mode 100644 index 0000000000000000000000000000000000000000..b267e817423f29ccb6a381183ee7752cb2e0364f --- /dev/null +++ b/doc/files/DistributedOperations/Provision/D012_01_red.json @@ -0,0 +1,43 @@ +{ + "tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_red", + "test_objective": "Check that one can create a batch of entities on the both Context Source thanks to a redirect registration", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.3.3, 4.3.6.3, 5.6.7", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.3.3", + "4.3.6.3", + "5.6.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Entity Id And 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 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": "D012_01_red Batch Create Entities With Redirect Registration", + "permutation_tp_id": "TP/NGSI-LD/DistributedOperations/Prov/BatchEntities/CreateBatchEntities/D012_01_red", + "doc": "Check that if one requests the Context Broker to create a batch of entities that match a redirect registration, these are created on the Context Source", + "tags": [ + "4_3_3", + "4_3_6_3", + "5_6_7", + "cf_06", + "dist-ops", + "proxy-exclusive", + "since_v1.6.1" + ], + "setup": "Setup Entity Id And Registration And Start Context Source Mock Server", + "teardown": "Delete Registration And Stop Context Source Mock Server", + "template": null, + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "DistributedOperations/Provision/BatchEntities/CreateBatchEntities", + "robotfile": "D012_01_red" +} \ No newline at end of file