telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

Timeinstant config parameter is ignored #1404

Closed mapedraza closed 1 year ago

mapedraza commented 1 year ago

IoT Agent Node Lib version the issue has been seen with

3.2.0

Bound or port used (API interaction)

Southbound (Devices data API), Northbound (Provision API and NGSI Interactions)

NGSI version

NGSIv2

Are you running a container?

Yes, I am using a contaner (Docker, Kubernetes...)

Image type

normal

Expected behaviour you didn't see

When using timeInstantparameter under a group, it is not working as expected. 6 possible cases analyzed

timeInstant value measure contains timeInstant actual behaviour expectation
true Yes TimeInstant and metadata updated with measure value works well - OK
true No TimeInstant and metadata updated with server timestamp works well - OK
false Yes TimeInstant and metadata updated with measure value should appear as attribute but not as metadata - NOK
false No TimeInstant and metadata updated with server timestamp should not appear neither as attribute not as metadata - NOK
Not defined Yes TimeInstant and metadata updated with measure value works well - OK
Not defined No TimeInstant and metadata updated with server timestamp works well - OK

Unexpected behaviour you saw

No response

Steps to reproduce the problem

No response

Configs

environment:
    - "IOTA_CB_HOST=orion"
    - "IOTA_CB_PORT=1026"
    - "IOTA_NORTH_PORT=4041"
    - "IOTA_REGISTRY_TYPE=mongodb"
    - "IOTA_MONGO_HOST=mongodb"
    - "IOTA_MONGO_PORT=27017"
    - "IOTA_MONGO_DB=iotagent-json"
    - "IOTA_HTTP_PORT=7896"
    - "IOTA_PROVIDER_URL=http://iot-agent:4041"

Log output

No response

mapedraza commented 1 year ago

Additionally, test does not implements all the cases: https://github.com/telefonicaid/iotagent-node-lib/blob/master/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js

AlvaroVega commented 1 year ago

Maybe related https://github.com/telefonicaid/iotagent-node-lib/issues/1377 and fix https://github.com/telefonicaid/iotagent-node-lib/pull/1391 ?

mapedraza commented 1 year ago

Having a quick look, does not seems. I am going to implement a test case, so we can check.

AlvaroVega commented 1 year ago
timeInstant value measure contains timeInstant actual behaviour expectation
false No TimeInstant and metadata updated with server timestamp should not appear neither as attribute not as metadata - NOK
-- -- -- --

This case happens when group has timestamp to false but device is autoprovisioned, and has no explicity defined timestamp at device level

typeInformation (device and groups has no timestmap but iotagent has IOTA_TIMESTAMP=true by default)

So this case works well when IOTA_TIMESTAMP=false

mapedraza commented 1 year ago

Added tests in PR https://github.com/telefonicaid/iotagent-node-lib/pull/1415

fgalan commented 1 year ago

Test cases covered by PR https://github.com/telefonicaid/iotagent-node-lib/pull/1415. Closing.