telefonicaid / fiware-IoTAgent-Cplusplus

IoTAgent development framework for C++
GNU Affero General Public License v3.0
11 stars 57 forks source link

Erase a device on IoTAgent does not erase entity on Context Broker? #411

Open usuarioIOT opened 8 years ago

usuarioIOT commented 8 years ago

Hi,

We have registered a device through IoTAgent Module UL2.0 (we also have configured an IotAgent Manager), when we POST a device through IoTAgent Module, an entity is automatically created on ContextBroker. We have two questions related to this process:

Static attributes described on Device are saved as ContextBroker entity attributes, but we can not see what happen with device attributes (object_id, etc). Are they mapped on another entity?

On the other hand, when we erase a device through IoTAgent we have check that device is erased on IDAS but its entity on ContextBroker still exists, therefore, when we want to erase a device, we have to erase both the CB entity and the IDAS device?

Thanks,

dmoranj commented 8 years ago

Concerning the first question: the initial device entity is created with just the bare entity identification data and the static attributes defined in the provisioning. The rest of the attributes will be created once the device has sent any to the IoTA using UL2.0.

Regarding the second question, both resources have to be erased if you want to erase a device, and this works like this by design (removing both it's not expected to be a future feature). The reason for this is that an entity may no reflect only the information of a single device; the information coming from a device may be mapped to an entity where other context providers are loading their data (from other sensors, from user input and so), and the user may want to remove the device information (e.g.: to replace it with another one) without removing all the information about the entity itself.

Hope this solves your questions.

agonlucas commented 8 years ago

When a device is created, IoTAgent creates the entity on Context Broker. I think you are creating a device with entity name as "entity_name" and this is the name of entity associated to device. Entity is created with attributes with value. That is, static attributes. "Dynamic" attributes (attributes associated with measures) are updated when a measure is received from device. At this moment, attribute mapping is done in order to publish mapped attributes (attributes received from a measure) on Context Broker. If device has two mapped attributes (e.g, object_id "a" (mapped to "A") and object_id "b" (mapped to "B") and it send a measure containing "a", you can see attribute "A" with value in "a" in entity "entity_name" (B only when device send "b" with a value).

usuarioIOT commented 8 years ago

Thanks! It's clear now.