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_01 Append entity attributes) #1501

Closed lafrigolet closed 9 months ago

lafrigolet commented 9 months ago

TP.NGSI-LD.ContextInformation.Provision.EntityAttributes.AppendEntityAttributes.010_01 :: 010_01_01 Append entity attributes

Context Broker Information:

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

010_01_01 Append entity attributes

Test Failed

Value of root['speed'][1] changed from {'type': 'Property', 'source': {'type': 'Property', 'value': 'GPS'}, 'datasetId': 'urn:ngsi-ld:Property:gpsBxyz123-speed', 'value': 54.5} to {'type': 'Property', 'value': 54.5, 'https://ngsi-ld-test-suite/context#source': {'type': 'Property', 'value': 'GPS'}, 'datasetId': 'urn:ngsi-ld:Property:gpsBxyz123-speed'}. Value of root['speed'][0] changed from {'type': 'Property', 'source': {'type': 'Property', 'value': 'Speedometer'}, 'datasetId': 'urn:ngsi-ld:Property:speedometer', 'value': 55} to {'type': 'Property', 'value': 55, 'https://ngsi-ld-test-suite/context#source': {'type': 'Property', 'value': 'Speedometer'}, 'datasetId': 'urn:ngsi-ld:Property:speedometer'}.

Test 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:4069273188136732", "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:09:11 GMT
Location: /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:4069273188136732
Content-Length: 0

Append Entity Attributes

Request:

POST http://127.0.0.1:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:4069273188136732/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: 249

{
    "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 204 No Content
Date: Wed, 13 Dec 2023 16:09:11 GMT

Retrieve Entity by Id

Request:

GET http://127.0.0.1:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:4069273188136732
Host: 127.0.0.1:1026
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate, br, zstd
Accept: application/ld+json
Connection: keep-alive
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"

Response:

HTTP/1.1 200 OK
Date: Wed, 13 Dec 2023 16:09:11 GMT
Content-Type: application/ld+json
Content-Length: 839

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

Delete Entity by Id

Request:

DELETE http://127.0.0.1:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:4069273188136732
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:09:11 GMT
kzangeli commented 9 months ago

Error: "datasetId given but not an array"