Closed manucarrace closed 4 years ago
What should be expected behaviour? To provide the union set of both (config level and device level) static attributs (givin priority to the ones in device level if some attribute is in both sets)?
Right. This is the expected behaviour
Hi @fgalan, @manucarrace As per my investigation, the entity created at Orion contains the static attributes defined at service level but the same does not stored at IOT database i.e. when we execute GET /iot/devices API, the same attribute is not displayed.
Service creation request: Created a service group using below as body of the request. Attribute bootstrapServer is provisioned as static attribute.
{
"services": [
{
"resource": "/device",
"apikey": "abcd",
"entity_type": "StreetlightControlCabinet",
"trust": "8970A9078A803H3BL98PINEQRW8342HBAMS",
"cbHost": "http://<orion>:1026",
"commands": [
{
"name": "wheel1",
"type": "Wheel"
}
],
"lazy": [
{
"name": "luminescence",
"type": "Lumens"
}
],
"attributes": [
{
"name": "status",
"type": "Boolean"
}
],
"static_attributes": [
{
"name": "bootstrapServer",
"type": "Address",
"value": "127.0.0.1"
}
]
}
]
}
Device creation request: Created a device using below as body of the request. No static attributes are given at device level.
{
"devices": [
{
"device_id": "Light1",
"protocol": "GENERIC_PROTO",
"entity_name": "TheFirstLight1",
"entity_type": "StreetlightControlCabinet",
"attributes": [{
"name": "temp",
"type": "Number"
}]
}
]
}
Output of Device GET request: No static attribute is displayed when we request GET /iot/devices.
{
"count": 1,
"devices": [
{
"device_id": "Light1",
"service": "ultest",
"service_path": "/",
"entity_name": "TheFirstLight1",
"entity_type": "StreetlightControlCabinet",
"transport": "HTTP",
"attributes": [
{
"object_id": "temp",
"name": "temp",
"type": "Number"
}
],
"lazy": [],
"commands": [],
"static_attributes": [],
"protocol": "GENERIC_PROTO",
"explicitAttrs": false
}
]
}
Entity created at Orion: As displayed in below screenshot, attribute bootstrapServer is created for the entity at Orion.
So, as per my understanding, the only need is to implement the code which will store the attribute bootstrapServer at IOT database so that same will be displayed for GET /iot/devices API. Please confirm my understanding.
Not sure if PR #908 fully solves this or is anything else pending... to be reviewed.
Hi @fgalan,
As per my understanding, PR #908 addresses this bug. I request you to please let me know if anything is still pending?
Thanks!
Hi @fgalan ,
Is there any update on this issue?
Thanks!
Original issue says:
If a Service (device group) is provisioned with static_attributes and then a device is provisioned also with static_attributes (different attributes), when a measure is sent to the apikey-device_id, only static_attributes from device are applied.
If device is provisioned without static_attibutes, static_attributes from service are applied.
Looking to the test added in #908 (just the descritpion, assuming the tests are correctly implemented) we have the following cases:
So, I understand they cover correctly the way of working so, after this analysis I think the issue is covered so I'll close it.
Of course, if somebody has a different opinion and think something is pending, tell so and I can re-open the issue.
If a Service (device group) is provisioned with static_attributes and then a device is provisioned also with static_attributes (different attributes), when a measure is sent to the apikey-device_id, only static_attributes from device are applied.
If device is provisioned without static_attibutes, static_attributes from service are applied.