FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
50 stars 43 forks source link

010 01 - Check that you can append entity attributes (010_01_02 Append entity attributes with different datasetid) #1517

Closed lafrigolet closed 11 months ago

lafrigolet commented 11 months ago

TP.NGSI-LD.ContextInformation.Provision.EntityAttributes.AppendEntityAttributes.010_01 :: 010_01_02 Append entity attributes with different datasetid

Context Broker Information:

Version: develop commit 238ac6c353325f8d486ef79ea137df20df12f277 Launch command: orionld -fg

010_01_02 Append entity attributes with different datasetid

Test Failed

HTTP status code comparison failed with (expected, actual) ->: 204 != 207 Find Attached all Request/Response Flow

Create Entity Selecting Content Type

Request:

POST http://127.0.0.1:1026/ngsi-ld/v1/entities/
Host: 127.0.0.1:1026
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Content-Type: application/ld+json
Content-Length: 757

{"id": "urn:ngsi-ld:Vehicle:6439354214038942", "type": "Vehicle", "brandName": {"type": "Property", "value": "Mercedes"}, "isParked": {"type": "Relationship", "object": "urn:ngsi-ld:OffStreetParking:Downtown1", "observedAt": "2017-07-29T12:00:04Z", "providedBy": {"type": "Relationship", "object": "urn:ngsi-ld:Person:Bob"}}, "speed": [{"type": "Property", "value": 55, "source": {"type": "Property", "value": "Speedometer"}, "datasetId": "urn:ngsi-ld:Property:speedometer"}, {"type": "Property", "value": 54.5, "source": {"type": "Property", "value": "GPS"}, "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed"}], "@context": ["https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld"]}

Response:

HTTP/1.1 201 Created
Date: Wed, 13 Dec 2023 16:22:55 GMT
Location: /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:6439354214038942
Content-Length: 0

Append Entity Attributes

Request:

POST http://127.0.0.1:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:6439354214038942/attrs/
Host: 127.0.0.1:1026
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Content-Type: application/ld+json
Content-Length: 486

{
    "speed": {
        "type": "Property",
        "value": 56,
        "source": {
            "type": "Property",
            "value": "Speedometer"
        },
        "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed2"
    },
    "attribute_to_be_added": {
        "type": "Property",
        "value": 23
    },
    "@context": [
        "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld"
    ]
}

Response:

HTTP/1.1 207 Multi-Status
Date: Wed, 13 Dec 2023 16:22:55 GMT
Link: <https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
Content-Type: application/json
Content-Length: 122

{"updated":["attribute_to_be_added"],"notUpdated":[{"attributeName":"speed","reason":"datasetId given but not an array"}]}

Delete Entity by Id

Request:

DELETE http://127.0.0.1:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:6439354214038942
Host: 127.0.0.1:1026
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Content-Length: 0

Response:

HTTP/1.1 204 No Content
Date: Wed, 13 Dec 2023 16:22:55 GMT