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

ngsi v2 configuration #791

Closed chicco785 closed 5 years ago

chicco785 commented 5 years ago

looking at the iot agent lib, it seems that configuration should specify the protocol used as follow:

        contextBroker: {
            host: '192.168.1.1',
            port: '1026',
            ngsiVersion: 'v2'
        }

This is not documented in any agent neither in the lib, afaik.

fgalan commented 5 years ago

The interaction with CB belongs to the northbound of the IOTAs so that is part of the IOTA Node Lib and its configuration. In particular, here: https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md#global-configuration

In addition, the associated env var (IOTA_CB_NGSI_VERSION) is described here: https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md#configuration-using-environment-variables.

However, it seems the documentation is slightly obsolete. "(only sending updates for active attributes)" should be removed as the support is currently wider (e.g. NGISv2-based registration is also supported).

Any suggestion to improve documentation in the form of a PR to the iotagnet-node-lib will be really apprecited. I'll transfer this issue to that repository.

Thanks for the feedback!

CC: @dcalvoalonso

dcalvoalonso commented 5 years ago

I have just created a PR with this small update in the docs: https://github.com/telefonicaid/iotagent-node-lib/pull/792

Please feel free to add comments to improve the documentation! ;)

chicco785 commented 5 years ago

@dcalvoalonso @fgalan shouldn't be this also available in the config.jsof the iot agents? e.g. https://github.com/telefonicaid/iotagent-json/blob/master/config.js ?

fgalan commented 5 years ago

@dcalvoalonso @fgalan shouldn't be this also available in the config.jsof the iot agents? e.g. https://github.com/telefonicaid/iotagent-json/blob/master/config.js ?

We should avoid duplicating documentation. Configuration related to the common functionality (such as the northbound) should be included in the library and a proper link should be added from IOTAs documentation to library documentation (maybe that link already exists?). Configuration specific to the IOTA (mainly documentation related to the southbound transport mechanism supported by the agent) should be included in the IOTA documentation.

Duplicating the same configuration in several places is, in general, a bad idea. It gets desynchronized very often and it is difficult and costly to keep it synced. For instance, instead of one fixing PR such as the #792 done by @dcalvoalonso we would need to do at least 5 fixing PRs (IOTA Node Lib + IOTA UL + IOTA JSON + IOTA Sigfox + IOTA LMWM... and probably more ones)!

chicco785 commented 5 years ago

i would anyhow improve the links from agents to lib docs, i think it may be of help :) will try a PR for UL as example.

fgalan commented 5 years ago

i would anyhow improve the links from agents to lib docs, i think it may be of help :) will try a PR for UL as example.

Thanks! PRs improving documentation are always welcome :)