简体   繁体   English

向非现有设备发送措施时会创建设备 - IoTAgent-UL

[英]Device is created when sending measures to non existing device - IoTAgent-UL

We've discovered a bug in the IoT Agent Ultralight. 我们在IoT Agent Ultralight中发现了一个错误。

If we try to send a measure to a non existing device, we'll get a 404 - DEVICE_NOT_FOUND error but at the same time a device without any attribute will be created in IoTA's and Orion CB's database. 如果我们尝试将度量发送到非现有设备,我们将得到404 - DEVICE_NOT_FOUND错误,但同时将在IoTA和Orion CB的数据库中创建没有任何属性的设备。

When I say a device without any attribute I refer to the following: 当我说一个没有任何属性的设备时,我会参考以下内容:

{
    "device_id": "test",
    "service": "MyService",
    "service_path": "/MyServicePath",
    "entity_name": "MyEntity:test",
    "entity_type": "MyEntity",
    "attributes": [],
    "lazy": [],
    "commands": [],
    "static_attributes": []
}

This is a very important bug, because it's really simple to create as many devices as someone wants and that could eat our database space. 这是一个非常重要的错误,因为创建尽可能多的设备非常简单,可能会占用我们的数据库空间。

Does someone know how to solve it? 有人知道如何解决它吗?

  • Which version of IotAgent-ul and external components, I mean, (Fiware OCB and MongoDB) are you using? 我指的是哪个版本的IotAgent-ul和外部组件(Fiware OCB和MongoDB)? It's highly recommend to use the latest one. 强烈建议使用最新的。
  • It's a good way to run OCB and MongoDB using docker images 这是使用docker镜像运行OCB和MongoDB的好方法
  • Could you provided us your commands/code that you used to send a meassure? 你能告诉我们你用来发送安慰的命令/代码吗?

From my self, I tested it and it works great: 从我自己,我测试它,它的效果很好:

Curl commands used to send a meassure: 用于发送meassure的Curl命令:

#!/usr/local/bin
mosquitto_pub -t /TEF/sensor03/attrs -m 't|45|c|extreme'

Response from IotAgent-ul: 来自IotAgent-ul的回复:

    {"op":"IOTAUL.Executable","time":"2018-09-21T09:59:17.906Z","lvl":"INFO","msg":"Ultralight 2.0 IoT Agent started"}
time=2018-09-21T09:59:32.679Z | lvl=DEBUG | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Looking for device with filter [{"id":"sensor03"}]. | comp=IoTAgent
Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
time=2018-09-21T09:59:32.717Z | lvl=ERROR | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IOTAUL.IoTUtils | srv=n/a | subsrv=n/a | msg=MEASURES-001: Couldn't find device data for APIKey [TEF] and DeviceId[sensor03] | comp=IoTAgent
time=2018-09-21T09:59:32.717Z | lvl=ERROR | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IOTAUL.Common.Binding | srv=n/a | subsrv=n/a | msg=MEASURES-005: Error before processing device measures [/TEF/sensor03/attrs] | comp=IoTAgent
time=2018-09-21T10:09:51.484Z | lvl=DEBUG | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Looking for device with filter [{"id":"sensor03"}]. | comp=IoTAgent
time=2018-09-21T10:09:51.504Z | lvl=ERROR | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IOTAUL.IoTUtils | srv=n/a | subsrv=n/a | msg=MEASURES-001: Couldn't find device data for APIKey [TEF] and DeviceId[sensor03] | comp=IoTAgent
time=2018-09-21T10:09:51.509Z | lvl=ERROR | corr=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | trans=dbbcd94d-50fc-4062-a05b-bccfa76c52c8 | op=IOTAUL.Common.Binding | srv=n/a | subsrv=n/a | msg=MEASURES-005: Error before processing device measures [/TEF/sensor03/attrs] | comp=IoTAgent

Show data from MongoDB 显示MongoDB中的数据

    root@727724bdd3d9:/# mongo --shell
MongoDB shell version: 3.2.21
connecting to: test
type "help" for help
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
> show dbs
iotagentul  0.000GB
local       0.000GB
orion       0.000GB

It seems to me that you have something wrong about your config set up. 在我看来,你的配置设置有问题。 Please provide us all the points before comment and for a nice follow up, could you open it in the Github site ? 请在评论之前提供所有要点,并提供良好的跟进,您能否在Github网站上打开它? IotAgent-UL Take up there IotAgent-UL从那里开始

Thanks, 谢谢,

Fernando Méndez - Research Junior Software Engineer FernandoMéndez - 研究初级软件工程师

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM