iotagent-node-lib icon indicating copy to clipboard operation
iotagent-node-lib copied to clipboard

Sending observations from a device associated to an entity with ambiguity in the type

Open danielvillalbamota opened this issue 6 years ago • 6 comments

As the uniqueness in the CB is defined by "entitiy_id" and "entity_type" we can have the following entities:

<service, subservice, entity_1, type_A>
<service, subservice, entity_1, type_B>

For this situation we need to use the "type" as URL parameter to distinguish the entity when we make requests to the CB. Example: https://host/v2/entities/entity_1?type=type_A

Then we create a device associate to an entity with this kind ambiguity, for example:

{
    "devices": [
        {
            "device_id": "tempSensorWSN_A",
            "entity_name": "entity_1",
            "entity_type": "type_A",
            "attributes": [
                  { "object_id": "t", "name": "temperature", "type": "float" },
                  { "object_id": "h", "name": "humidity", "type": "float" }
            ],
      "protocol": "IoTA-UL",
      "transport": "HTTP"
        }
    ]
}

the creation is correct but when we try to send observations through the IoTA (UL2.0 is what I tested), the answer is:

{
    "name": "ENTITY_GENERIC_ERROR",
   "message": "Error accesing entity data for device: entity_1 of type: type_A"
}

It seems like the IoTA does not add the type paramenter to the URL when create the request to the CB as is needed in these cases.

danielvillalbamota avatar Dec 27 '18 17:12 danielvillalbamota

Partially fixed by PR #734

fgalan avatar Jan 11 '19 13:01 fgalan

Pending entry (we forgot it in PR #734):

- Fix: add ?type parameter in CB request updates to avoid potential entity ambiguities (#733)

fgalan avatar Jan 24 '19 11:01 fgalan

From https://github.com/telefonicaid/iotagent-node-lib/pull/734/files#r249474148, some modifications are pending before we can consider this issue as closed.

@dcalvoalonso will you take care of it at the end, please? Thanks!

fgalan avatar Jan 24 '19 11:01 fgalan

Sure, no problem at all.

dcalvoalonso avatar Jan 24 '19 11:01 dcalvoalonso

PR https://github.com/telefonicaid/iotagent-node-lib/pull/751 concludes the work at iotagent-node-lib

However, I'll keep this issue while IOTA-JSON and IOTA-UL test gets failing. @dcalvoalonso I can take care of it, although if I find difficulties maybe I'll ask help :)

fgalan avatar Jan 25 '19 10:01 fgalan

Great! Thanks @fgalan !

dcalvoalonso avatar Jan 25 '19 10:01 dcalvoalonso