telefonicaid / lightweightm2m-iotagent

IoT Agent accepting COAP requests. Designed to be a bridge between the OMA Lightweight M2M protocol and the NGSI interface.
https://fiware-iotagent-lwm2m.rtfd.io/
GNU Affero General Public License v3.0
24 stars 30 forks source link

OMA Registry Mappingd #14

Open dmoranj opened 9 years ago

dmoranj commented 9 years ago

Some decisions were taken concerning OMA Registry mapping that may be subjected to further discussion:

dmoranj commented 9 years ago

Currently, all the attributes included in the OMA Registry are mapped, whether they have a DDF definition or not, but making some assumptions that may or may not be acceptable: those attributes not specified in the Device or Group definition are considered lazy, and they are considered to belong to a single instance with ID '0'. For those objects lacking DDF, a single attribute is generated with the name of the object, assuming they have an instance with ID '0' with a single resource with ID '0'.

All this rules should be clarified and documented in the repository documentation.

lilezek commented 8 years ago

I've noticed that recently. Is there any way to avoid it? The context broker is asking for resources with /typeID/0/0 and obviously receiving a 4.04 each time.

dmoranj commented 8 years ago

The best way to avoid it is to explicitly declare those attributes in the device provisioning requests (using the internalattributes mapping). This is a really old issue, and we may need to rethink it, I'll have to speak with the IoT Chapter architect about it.

lilezek commented 8 years ago

But I already have the mapping (following this pattern):

// This JSON is in config.ngsi.types
'MexST': {
      "service": "testing",
      "subservice": "/mexst",
      "removeSuffix": true,
      "commands": [{
        "name": "Light Control",
        "type": "number"
      }],
      "lazy": [],
      "active": [{
        "name": "Temperature",
        "type": "number"
      }, {
        "name": "Humidity",
        "type": "number"
      }, {
        "name": "Luminosity",
        "type": "number"
      }],
      "lwm2mResourceMapping": {
        "Humidity": {
          "objectType": 3303,
          "objectInstance": 0,
          "objectResource": 5700
        },
        "Temperature": {
          "objectType": 3304,
          "objectInstance": 0,
          "objectResource": 5700
        },
        "Luminosity": {
          "objectType": 3301,
          "objectInstance": 0,
          "objectResource": 5700
        },
        "Light Control": {
          "objectType": 3311,
          "objectInstance": 0,
          "objectResource": 5851
        }
      }
    }

But each time I ask for an element in context broker using:

(curl http://192.168.56.2:1026/v1/queryContext -s -S --header 'Content-Type: application/json' \
 --header 'Accept: application/json' --header 'fiware-service: testing' --header 'fiware-servicepath: /mexst' \
 -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "MexST",
            "isPattern": "false",
            "id": "testing:MexST"
        }
    ]
}
EOF

404 happens:

captura de pantalla de 2015-11-30 15 53 34

As far as I understand, active attributes shouldn't trigger a request.

dmoranj commented 8 years ago

And you are right. They shouldn't. It seems to me there may be some bug regarding active attribute registration. I'll try to check it.