Comments (4)
And using different apikeys ?
Group unique key is compose of apikey and resource:
iotagent-node-lib/lib/model/Group.js
Line 70 in 1315955
When iotagent tries to register a new group it search by apikey + resource to get if a duplicate one is already register. If a invalid o none apikey is provided with new group then a DuplicateError is raised. Maybe this error is confusion prone
from iotagent-node-lib.
It seems the case involves:
Several groups with different apikeys and the same type (entity_type) and different static attributes and auto-provisioning devices
Proof of concept:
Creating 4 groups with type "thing", and stX attribute in each group and different apikeys.
curl -i -X POST 'http://localhost:7897/iot/json?i=dispAAA&k=apbdqbt7334hvav0dfa8vmafk' -d '{ "level": "33"}' -H 'content-type: application/json'
Logs obtained:
time=2022-11-04T11:00:43.289Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IOTAJSON.HTTP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Using body [{ level: '33' }] | comp=IoTAgent
time=2022-11-04T11:00:43.291Z | lvl=DEBUG | corr=2c8169a5-7037-4df1-a5b8-7509f69dd604 | trans=2c8169a5-7037-4df1-a5b8-7509f69dd604 | op=IOTAJSON.HTTP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Parsed data array: [[{"level":"33"}]] | comp=IoTAgent
time=2022-11-04T11:00:43.291Z | lvl=DEBUG | corr=2c8169a5-7037-4df1-a5b8-7509f69dd604 | trans=2c8169a5-7037-4df1-a5b8-7509f69dd604 | op=IOTAJSON.HTTP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Processing multiple HTTP measures for device [dispAAA] with apiKey [apbdqbt7334hvav0dfa8vmafk] | comp=IoTAgent
time=2022-11-04T11:00:43.292Z | lvl=DEBUG | corr=2c8169a5-7037-4df1-a5b8-7509f69dd604 | trans=2c8169a5-7037-4df1-a5b8-7509f69dd604 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["resource","apikey"] with queryObj {"resource":"/iot/json","apikey":"apbdqbt7334hvav0dfa8vmafk"} | comp=IoTAgent
(node:1) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
time=2022-11-04T11:00:43.300Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=smartcity | subsrv=/ | msg=Device group data found: {"_id":"6363b2c061e2ca1a24ad0808","commands":[],"staticAttributes":[{"name":"st3","type":"string","value":"st3"}],"attributes":[],"resource":"/iot/json","apikey":"apbdqbt7334hvav0dfa8vmafk","type":"thing","service":"smartcity","subservice":"/","description":"mijson3"} | comp=IoTAgent
time=2022-11-04T11:00:43.301Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MongoDBDeviceRegister | from=n/a | srv=smartcity | subsrv=/ | msg=Looking for device with id [dispAAA]. | comp=IoTAgent
time=2022-11-04T11:00:43.307Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MongoDBDeviceRegister | from=n/a | srv=smartcity | subsrv=/ | msg=Device data found: {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP"} | comp=IoTAgent
time=2022-11-04T11:00:43.308Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.DeviceService | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData before merge with conf: {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP"} | comp=IoTAgent
time=2022-11-04T11:00:43.309Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.DeviceService | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData after merge with conf: {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"},{"name":"st3","type":"string","value":"st3"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP","lazy":null,"active":[]} | comp=IoTAgent
time=2022-11-04T11:00:43.310Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IOTAJSON.HTTP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Processing measure device [thing:dispAAA] with attributeArr [[[{"name":"level","type":"string","value":"33"}]]] attributeValues [[{"name":"level","type":"string","value":"33"}]] | comp=IoTAgent
time=2022-11-04T11:00:43.311Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.NGSIService | from=n/a | srv=smartcity | subsrv=/ | msg=executeWithDeviceInfo entityName thing:dispAAA type thing apikey attributes [{"name":"level","type":"string","value":"33"}] deviceInformation {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"},{"name":"st3","type":"string","value":"st3"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP","lazy":null,"active":[]} | comp=IoTAgent
time=2022-11-04T11:00:43.311Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {"type":"thing"} | comp=IoTAgent
time=2022-11-04T11:00:43.314Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=smartcity | subsrv=/ | msg=Device group data found: {"_id":"6363b27761e2ca1428ad07dc","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"}],"attributes":[],"resource":"/iot/json","apikey":"n60jhuxo6sdz2jqxf79pym63p","type":"thing","service":"smartcity","subservice":"/","description":"mijson1"} | comp=IoTAgent
time=2022-11-04T11:00:43.315Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.NGSIUtils | from=n/a | srv=smartcity | subsrv=/ | msg=typeInformation {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"},{"name":"st3","type":"string","value":"st3"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP","lazy":null,"active":[]} | comp=IoTAgent
time=2022-11-04T11:00:43.317Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.expressionPlugin | from=n/a | srv=smartcity | subsrv=/ | msg=expressionPlugin entity {"level":{"type":"string","value":"33"},"st1":{"type":"string","value":"st1"},"st3":{"type":"string","value":"st3"},"id":"thing:dispAAA","type":"thing"} | comp=IoTAgent
time=2022-11-04T11:00:43.318Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.MultiEntityPlugin | from=n/a | srv=smartcity | subsrv=/ | msg=multiEntityPlugin entity {"level":{"type":"string","value":"33"},"st1":{"type":"string","value":"st1"},"st3":{"type":"string","value":"st3"},"id":"thing:dispAAA","type":"thing"} | comp=IoTAgent
time=2022-11-04T11:00:43.319Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Entities-v2 | from=n/a | srv=smartcity | subsrv=/ | msg=typeInformation: {"_id":"6363b4be61e2ca13c3ad0828","commands":[],"staticAttributes":[{"name":"st1","type":"string","value":"st1"},{"name":"st3","type":"string","value":"st3"}],"subscriptions":[],"creationDate":"2022-11-03T12:31:58.088Z","id":"dispAAA","type":"thing","name":"thing:dispAAA","service":"smartcity","subservice":"/","protocol":"IoTA-JSON","transport":"HTTP","lazy":null,"active":[]} | comp=IoTAgent
time=2022-11-04T11:00:43.320Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Entities-v2 | from=n/a | srv=smartcity | subsrv=/ | msg=Updating device value in the Context Broker at [http://iot-orion:1026/v2/entities/thing:dispAAA/attrs?type=thing] | comp=IoTAgent
time=2022-11-04T11:00:43.320Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Entities-v2 | from=n/a | srv=smartcity | subsrv=/ | msg=Using the following NGSI v2 request:
{
"url": "http://iot-orion:1026/v2/entities/thing:dispAAA/attrs?type=thing",
"method": "POST",
"headers": {
"fiware-service": "smartcity",
"fiware-servicepath": "/"
},
"json": {
"level": {
"type": "string",
"value": "33",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"st1": {
"type": "string",
"value": "st1",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"st3": {
"type": "string",
"value": "st3",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
}
| comp=IoTAgent
time=2022-11-04T11:00:43.320Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Request | from=n/a | srv=smartcity | subsrv=/ | msg=Options: {
"url": "http://iot-orion:1026/v2/entities/thing:dispAAA/attrs?type=thing",
"method": "POST",
"headers": {
"fiware-service": "smartcity",
"fiware-servicepath": "/"
},
"json": {
"level": {
"type": "string",
"value": "33",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"st1": {
"type": "string",
"value": "st1",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"st3": {
"type": "string",
"value": "st3",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
},
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-04T11:00:43.319Z"
}
}
} | comp=IoTAgent
time=2022-11-04T11:00:43.333Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Request | from=n/a | srv=smartcity | subsrv=/ | msg=Response "" | comp=IoTAgent
time=2022-11-04T11:00:43.334Z | lvl=INFO | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.Entities-v2 | from=n/a | srv=smartcity | subsrv=/ | msg=Received the following response from the CB: Value updated successfully
| comp=IoTAgent
time=2022-11-04T11:00:43.334Z | lvl=INFO | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IOTAJSON.HTTP.Binding | from=n/a | srv=smartcity | subsrv=/ | msg=Multiple measures for device [dispAAA] with apiKey [apbdqbt7334hvav0dfa8vmafk] successfully updated | comp=IoTAgent
time=2022-11-04T11:00:43.334Z | lvl=DEBUG | corr=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | trans=b9820aa0-4c1a-4ea7-9c1c-3f0cfb3a01fd | op=IoTAgentNGSI.DomainControl | from=n/a | srv=smartcity | subsrv=/ | msg=response-time: 129591 | comp=IoTAgent
from iotagent-node-lib.
Hi @fgalan and @AlvaroVega, I was investigating this issue.
It is mentioned the merged PR #1275 for the issue. Could you please let me know that if the work is still in progress for the issue (#1294) or Is it fixed and ready to close?
Also, I've found that for the iot-agents json and ul, the PR has been raised and merged for both.
For reference:
PR for iot-agent json - "use group apikey for autoprovision device #683" (telefonicaid/iotagent-json#683).
PR for iot-agent ul- "use group apikey for autoprovision device #583" (telefonicaid/iotagent-ul#583).
from iotagent-node-lib.
I think we can close now this issue.
from iotagent-node-lib.
Related Issues (20)
- allow define transport in device group HOT 1
- NGSI-LD observedAt is ignoring timezone from service or device for multivariable sensor HOT 3
- FIWARE ServicePath wildcard not working when listing devices HOT 3
- Timeinstant as attribute case (not measure) HOT 5
- No CMD attributes added when sending push commands (using `endpoint`) HOT 8
- Change type from string to Text HOT 3
- NGSI entity is missing attributes with manual device provisioning through Rest API HOT 10
- create mongodb index over Device collection HOT 3
- add new API to delete high number of devices HOT 3
- More flexible functional test (to cover northbound-only interactions)
- Remove dependency on deprecated domain module HOT 1
- active attributes are stored in Device model (mongo) as "active" but are stored in Group Model as "attributes" HOT 3
- Wrong association of measurements to the correct device using different service groups but same device_id HOT 10
- ENTITY_GENERIC_ERROR is logging so much info HOT 2
- Allow use a different TimesInstant wording for metadata HOT 3
- allow use measures with metadatas it will be constants HOT 1
- allow to define metadatas in device attributes HOT 1
- Add `timestamp` tests HOT 1
- Problems with explicitAttrs and TimeInstan #1605 HOT 4
- sort multimeasures by an attribute (by TimeInstant ) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotagent-node-lib.