iotagent-node-lib 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.github/workflows/ci.yml +0 -1
  2. package/Changelog +12 -0
  3. package/README.md +67 -272
  4. package/config.js +3 -1
  5. package/doc/README.md +1 -1
  6. package/doc/admin.md +40 -18
  7. package/doc/api.md +532 -136
  8. package/doc/deprecated.md +4 -0
  9. package/doc/devel/architecture.md +5 -135
  10. package/doc/devel/development.md +224 -12
  11. package/doc/getting-started.md +114 -53
  12. package/doc/requirements.txt +1 -1
  13. package/doc/roadmap.md +5 -5
  14. package/docker/Mosquitto/Dockerfile +2 -2
  15. package/docker/Mosquitto/README.md +14 -11
  16. package/lib/commonConfig.js +21 -2
  17. package/lib/constants.js +3 -0
  18. package/lib/fiware-iotagent-lib.js +12 -15
  19. package/lib/jexlTranformsMap.js +3 -1
  20. package/lib/model/Command.js +2 -2
  21. package/lib/model/Device.js +7 -3
  22. package/lib/model/Group.js +5 -3
  23. package/lib/model/dbConn.js +53 -115
  24. package/lib/services/commands/commandRegistryMongoDB.js +115 -75
  25. package/lib/services/common/alarmManagement.js +3 -0
  26. package/lib/services/common/iotManagerService.js +3 -1
  27. package/lib/services/devices/deviceRegistryMemory.js +36 -0
  28. package/lib/services/devices/deviceRegistryMongoDB.js +160 -87
  29. package/lib/services/devices/deviceService.js +33 -3
  30. package/lib/services/devices/devices-NGSI-v2.js +6 -1
  31. package/lib/services/groups/groupRegistryMongoDB.js +120 -83
  32. package/lib/services/groups/groupService.js +1 -1
  33. package/lib/services/ngsi/entities-NGSI-LD.js +320 -570
  34. package/lib/services/ngsi/entities-NGSI-v2.js +51 -3
  35. package/lib/services/ngsi/ngsiService.js +34 -1
  36. package/lib/services/northBound/deviceGroupAdministrationServer.js +42 -6
  37. package/lib/services/northBound/deviceProvisioningServer.js +12 -4
  38. package/lib/services/northBound/northboundServer.js +2 -0
  39. package/lib/services/stats/statsRegistry.js +128 -101
  40. package/lib/templates/createDevice.json +0 -24
  41. package/lib/templates/createDeviceLax.json +0 -23
  42. package/lib/templates/deviceGroup.json +1 -25
  43. package/lib/templates/updateDevice.json +12 -24
  44. package/lib/templates/updateDeviceLax.json +12 -23
  45. package/package.json +5 -5
  46. package/scripts/legacy_expression_tool/README.md +0 -1
  47. package/test/functional/README.md +22 -17
  48. package/test/functional/config-test.js +3 -2
  49. package/test/functional/functional-tests-runner.js +9 -4
  50. package/test/functional/functional-tests.js +4 -4
  51. package/test/functional/testCases.js +245 -4
  52. package/test/functional/testUtils.js +2 -2
  53. package/test/unit/examples/deviceProvisioningRequests/provisionFullDevice.json +1 -13
  54. package/test/unit/examples/groupProvisioningRequests/multipleConfigGroupsCreation.json +44 -0
  55. package/test/unit/examples/groupProvisioningRequests/provisionDuplicateConfigGroup.json +35 -0
  56. package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroup.json +36 -0
  57. package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroupAlternate.json +36 -0
  58. package/test/unit/examples/groupProvisioningRequests/provisionFullGroup.json +1 -0
  59. package/test/unit/general/config-multi-core-test.js +1 -2
  60. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +5 -4
  61. package/test/unit/general/deviceService-test.js +106 -3
  62. package/test/unit/general/statistics-service_test.js +1 -74
  63. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +6 -5
  64. package/test/unit/mongodb/mongodb-configGroup-registry-test.js +452 -0
  65. package/test/unit/mongodb/mongodb-connectionoptions-test.js +9 -42
  66. package/test/unit/mongodb/mongodb-group-registry-test.js +34 -33
  67. package/test/unit/mongodb/mongodb-service-registry-test.js +477 -0
  68. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +4 -4
  69. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin2.json +22 -22
  70. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +4 -4
  71. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +14 -15
  72. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin1.json +23 -23
  73. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +0 -5
  74. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin4.json +11 -16
  75. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin5.json +23 -28
  76. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin6.json +8 -13
  77. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin7.json +0 -5
  78. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin8.json +24 -29
  79. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +12 -17
  80. package/test/unit/ngsi-ld/examples/contextRequests/updateContextStaticLinkedAttributes.json +12 -10
  81. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1 -104
  82. package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +1 -2
  83. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +4 -5
  84. package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +0 -4
  85. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +8 -5
  86. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +42 -41
  87. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +11 -10
  88. package/test/unit/ngsiv2/general/deviceService-test.js +98 -4
  89. package/test/unit/ngsiv2/general/https-support-test.js +1 -1
  90. package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +195 -0
  91. package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +4 -3
  92. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +6 -5
  93. package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +17 -16
  94. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +10 -18
  95. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +21 -20
  96. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +8 -7
  97. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +12 -11
  98. package/test/unit/ngsiv2/plugins/custom-plugin_test.js +3 -2
  99. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +28 -27
  100. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +265 -4
  101. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +12 -11
  102. package/test/unit/ngsiv2/provisioning/device-provisioning-configGroup-api_test.js +1190 -0
  103. package/test/unit/ngsiv2/provisioning/device-registration_test.js +5 -4
  104. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +6 -9
  105. package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +1 -1
  106. package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +5 -4
  107. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +8 -7
  108. package/test/unit/statsRegistry/openmetrics-test.js +167 -0
  109. package/lib/templates/queryContext.json +0 -25
  110. package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +0 -35
  111. package/test/unit/examples/deviceProvisioningRequests/provisionDeviceBidirectionalGroup.json +0 -17
  112. package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +0 -31
  113. package/test/unit/general/statistics-persistence_test.js +0 -121
  114. package/test/unit/ngsi-ld/examples/contextRequests/createBidirectionalDevice.json +0 -17
  115. package/test/unit/ngsi-ld/examples/contextRequests/updateContextProcessTimestamp.json +0 -12
  116. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
  117. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithDatasetId.json +0 -21
  118. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -17
  119. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -23
  120. package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +0 -132
  121. package/test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json +0 -8
  122. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
  123. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -19
  124. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -24
@@ -51,7 +51,6 @@ jobs:
51
51
  strategy:
52
52
  matrix:
53
53
  node-version:
54
- - 14.x
55
54
  - 16.x
56
55
  - 18.x
57
56
  steps:
package/Changelog ADDED
@@ -0,0 +1,12 @@
1
+ 4.7.0 (February 3rd, 2025)
2
+
3
+ - Add: store (and recover) previous jexlctxt and make available in current jexlctxt (#1690)
4
+ - Add: option to force to use CB flow control with new API field useCBflowControl at group and device device level (#1420)
5
+ - Add: useCBflowControl config setting (IOTA_CB_FLOW_CONTROL env var) to set CB flow control behaviour at instance level (#1420)
6
+ - Add: allow remove last measure in device
7
+ - Add: store last measure in device (by id, apikey, service and subservice) and new API field storeLastMeasure at group and device levels (#1669)
8
+ - Add: storeLastMeasure config setting (IOTA_STORE_LAST_MEASURE env var) to set default store last measure behaviour at instance level (#1669)
9
+ - Fix: set polling and transport for autoprovisioned devices
10
+ - Upgrade express dep from 4.19.2 to 4.21.2
11
+ - Upgrade mongodb devdep from 4.17.1 to 4.17.2
12
+ - Upgrade mongoose dep from 5.13.20 to 8.9.5 (solving vulnerabilies CVE-2024-53900 and CVE-2025-23061) (#1674)
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # FIWARE IoT Agent Node.js Library
1
+ # FIWARE IoT Agent Node Library
2
2
 
3
3
  [![FIWARE IoT Agents](https://nexus.lab.fiware.org/static/badges/chapters/iot-agents.svg)](https://www.fiware.org/developers/catalogue/)
4
4
  [![License: APGL](https://img.shields.io/github/license/telefonicaid/iotagent-node-lib.svg)](https://opensource.org/licenses/AGPL-3.0)
@@ -10,300 +10,95 @@
10
10
  ![Status](https://nexus.lab.fiware.org/static/badges/statuses/iot-node-lib.svg)
11
11
  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4671/badge)](https://bestpractices.coreinfrastructure.org/projects/4671)
12
12
 
13
- This project aims to provide a Node.js module to enable IoT Agent developers to build custom agents for their devices
14
- that can easily connect to NGSI Context Brokers (such as [Orion](https://github.com/telefonicaid/fiware-orion)).
13
+ An IoT Agent is a component that lets groups of IoT devices send their data to a NGSI Context Broker (such as
14
+ [Orion Context Broker](https://github.com/telefonicaid/fiware-orion)) using their own native protocols and translating
15
+ them into NGSI.
15
16
 
16
- An IoT Agent is a component that lets groups of devices send their data to and be managed from a FIWARE NGSI Context
17
- Broker using their own native protocols. IoT Agents should also be able to deal with security aspects of the FIWARE
18
- platform (authentication and authorization of the channel) and provide other common services to the device programmer.
17
+ The **IoT Agent Node Lib** provides simple standardized REST API for registering, provisioning, discovering and managing
18
+ devices and groups of devices. It also ensures that each IoT Agent can configure its device communications using a
19
+ common vocabulary regardless of the payload, syntax or transport protocol used by the device itself
19
20
 
20
- This project is part of [FIWARE](https://www.fiware.org/). For more information check the FIWARE Catalogue entry for the
21
- [IoT Agents](https://github.com/Fiware/catalogue/tree/master/iot-agents).
22
-
23
- | :books: [Documentation](https://iotagent-node-lib.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/iot-agents/idas) | :dart: [Roadmap](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/roadmap.md) |
24
- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
25
-
26
- ## Index
27
-
28
- - [Background](#background)
29
- - [Install](#install)
30
- - [API](#api)
31
- - [Usage](#usage)
32
- - [Testing](#testing)
33
- - [Agent Console](#agent-console)
34
- - [Agent tester](#agent-tester)
35
- - [Licence](#licence)
21
+ It also provides a common configuration framework driven by a `config.js` configuration file and a series of common ENV
22
+ variables, configuring some flags for common functionality provided by the **IoT Agent node lib** (e.g. for contecting
23
+ to a Conext Broker or for authenticating with an Identity Manager).Some of common utility functions provided by the
24
+ **IoT Agent node lib** include:
36
25
 
37
- ## Background
38
-
39
- The main concept of the **IoT Agent node library** is to provide a common framework for provisioning IoT devices,
40
- allowing each individual IoT Agent to access standardized mapping data for devices and to offer a series common utility
41
- functions.
42
-
43
- - For southbound communications, the library listens to changes in context entities and raises callbacks for the IoT
44
- Agent to process.
45
- - For northbound communications, the library offers an interface which accepts structured input data so that all NGSI
46
- communications are left to the library.
26
+ - For the device communication (southbound), the library listens to changes in context entities and raises callbacks
27
+ for the IoT Agent to process. It also handles the commands sent by the Context Broker to the devices.
28
+ - For the context broker communications (northbound), the library offers an interface which persists data from the
29
+ device in the Context Broker and accepts NGSI data from the Context Broker to be sent to the device.
47
30
  - Standardized OAuth2-based security is available to enable each IoT Agent to connect to several common Identity
48
31
  Managers (e.g. Keystone and Keyrock) so that communications can be restricted to trusted components.
49
32
 
50
- Each individual IoT Agent offers is driven by a `config.js` configuration file contains explicit custom settings based
51
- on the protocol and payload the IoT Agent is translating. It will also contain some common flags for common
52
- functionality provided by the IoT Agent node lin (e.g. for contecting to a conext broker or for authentication). The
53
- **IoT Agent node library** offers a standard API for provisioning devices and ensures that each IoT Agent can configure
54
- its device communications using a common vocabulary regardless of the payload, syntax or transport protocol used by the
55
- device itself.
56
-
57
- ## Install
58
-
59
- The **IoT Agent node library** is not a standalone product and should be added as a dependency to `package.json` of the
60
- IoT Agent
61
-
62
- ```json
63
- ...
64
- "dependencies": {
65
- "iotagent-node-lib": "*",
66
- }
67
- ```
68
-
69
- In order to use the library within your own IoT Agent, you must first you require it before use:
70
-
71
- ```javascript
72
- const iotagentLib = require('iotagent-node-lib');
73
- ```
74
-
75
- Information about how to configure the Library can be found at the corresponding section of the
76
- [Installation & Administration Guide](doc/admin.md).
77
-
78
- ## Usage
79
-
80
- This library has no packaging or build processes. The [Getting Started](./doc/getting-started.md) is a good place to
81
- start. You can also review the [API documentation](./doc/api.md) for a full list of the available functions.
82
-
83
- If you plan to use the library in your own IoT Agent, you should read the [Developer Guide](./doc/devel/development.md).
84
- You can also review the [Architecture](./doc/devel/architecture.md) documentation and
85
- [Northbound API](./doc/devel/northbound-api.md).
86
-
87
- The following features are listed as [deprecated](doc/deprecated.md).
88
-
89
- ## API
90
-
91
- The **IoT Agent node library** offers a simple REST API which provides common functionality to access, provision and
92
- decommission devices. [API](doc/api.md).
93
-
94
- ## Testing
95
-
96
- Contributions to development can be found [here](doc/devel/development.md) - additional contributions are welcome.
97
-
98
- If you are whishing to test the library, or include new tests (either as part of a contribution or as a new feature or
99
- as a bug report), you can use the functional tests suite included in the project. The tests are described using a JSON
100
- file. You can find more information about the test suite in the [Functional Tests Guide](test/functional/README.md).
101
-
102
- ### Agent Console
103
-
104
- A command-line client to experiment with the library is packed with it. The command-line client can be started using the
105
- following command:
106
-
107
- ```console
108
- bin/agentConsole.js
109
- ```
110
-
111
- The client offers an API similar to the one offered by the library: it can start and stop an IoT agent, register and
112
- unregister devices, send measures mimicking the device and receive updates of the device data. Take into account that,
113
- by default, the console uses the same `config.js` file than the IoT Agent.
114
-
115
- The command-line client creates a console that offers the following options:
116
-
117
- ```text
118
- stressInit
119
-
120
- Start recording a stress batch.
121
-
122
- stressCommit <delay> <times> <threads> <initTime>
123
-
124
- Executes the recorded batch as many times as requested, with delay (ms) between commands.
125
- The "threads" parameter indicates how many agents will repeat that same sequence. The "initTime" (ms)
126
- parameter indicates the mean of the random initial waiting times for each agent.
127
-
128
- exit
129
-
130
- Exit from the command-line.
131
-
132
- start
133
-
134
- Start the IoT Agent
135
-
136
- stop
137
-
138
- Stop the IoT Agent
139
-
140
- register <id> <type>
141
-
142
- Register a new device in the IoT Agent. The attributes to register will be extracted from the
143
- type configuration
144
-
145
- unregister <id> <type>
146
-
147
- Unregister the selected device
148
-
149
- showConfig
150
-
151
- Show the current configuration file
152
-
153
- config <newConfig>
154
-
155
- Change the configuration file to a new one
156
-
157
- updatevalue <deviceId> <deviceType> <attributes>
158
-
159
- Update a device value in the Context Broker. The attributes should be triads with the following
160
- format: "name/type/value" sepparated by commas.
161
-
162
- listdevices
163
-
164
- List all the devices that have been registered in this IoT Agent session
165
- ```
166
-
167
- ### Agent tester
168
-
169
- #### Command-line testing
170
-
171
- The library also offers a Context Broker and IoT Agent client that can be used to:
172
-
173
- - Simulate operations to the Context Broker used by the IoT Agent, triggering Context Provider forwardings for lazy
174
- attributes and checking the appropriate values for active ones.
175
- - Simulate operations to the Device Provisioning API and Configuration API of the IoT Agent.
176
-
177
- The tester can be started with the following command, from the root folder of the project:
178
-
179
- ```console
180
- bin/iotAgentTester.js
181
- ```
182
-
183
- From the command-line, the `help` command can be used to show a description of the currently supported features. These
184
- are the following:
185
-
186
- ```text
187
- stressInit
188
-
189
- Start recording a stress batch.
190
-
191
- stressCommit <delay> <times> <threads> <initTime>
192
-
193
- Executes the recorded batch as many times as requested, with delay (ms) between commands.
194
- The "threads" parameter indicates how many agents will repeat that same sequence. The "initTime" (ms)
195
- parameter indicates the mean of the random initial waiting times for each agent.
196
-
197
- exit
198
-
199
- Exit from the command-line.
200
-
201
- update <entity> <type> <attributes>
202
-
203
- Update the values of the defined set of attributes, using the following format: name#type=value(|name#type=value)*
204
-
205
- append <entity> <type> <attributes>
206
-
207
- Append a new Entity with the defined set of attributes, using the following format: name:type=value(,name:type=value)*
208
-
209
- query <entity> <type>
210
-
211
- Get all the information on the selected object.
212
-
213
- queryAttr <entity> <type> <attributes>
214
-
215
- Get information on the selected object for the selected attributes.
216
-
217
- discover <entity> <type>
218
-
219
- Get all the context providers for a entity and type.
220
-
221
- configCb <host> <port> <service> <subservice>
222
-
223
- Config a new host and port for the remote Context Broker.
224
-
225
- showConfigCb
226
-
227
- Show the current configuration of the client for the Context Broker.
228
-
229
- configIot <host> <port> <service> <subservice>
230
-
231
- Config a new host and port for the remote IoT Agent.
232
-
233
- showConfigIot
234
-
235
- Show the current configuration of the client for the IoT Agent.
236
-
237
- provision <filename>
238
-
239
- Provision a new device using the Device Provisioning API. The device configuration is
240
- read from the file specified in the "filename" parameter.
241
-
242
- provisionGroup <template> <data> <type>
243
-
244
- Provision a group of devices with the selected template, taking the information needed to
245
- fill the template from a CSV with two columns, DEVICE_ID and DEVICE_NAME. The third parameter, type
246
- will be used to replace the DEVICE_TYPE field in the template. All the devices will be provisioned
247
- to the same IoT Agent, once the templates have been fulfilled.
248
-
249
- listProvisioned
250
-
251
- List all the provisioned devices in an IoT Agent.
252
-
253
- removeProvisioned <deviceId>
254
-
255
- Remove the selected provisioned device from the IoT Agent, specified by its Device ID.
256
-
257
- addGroup <filename>
258
-
259
- Add a new device group to the specified IoT Agent through the Configuration API. The
260
- body is taken from the file specified in the "filename" parameter.
261
-
262
- listGroups
263
-
264
- List all the device groups created in the selected IoT Agent for the configured service
265
-
266
- removeGroup <apiKey> <resource>
33
+ This project is part of [FIWARE](https://www.fiware.org/). For more information check the FIWARE Catalogue entry for the
34
+ [IoT Agents](https://github.com/Fiware/catalogue/tree/master/iot-agents).
267
35
 
268
- Remove the device group corresponding to the current configured subservice.
36
+ | :books: [Documentation](https://iotagent-node-lib.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/iot-agents/idas) | :dart: [Roadmap](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/roadmap.md) |
37
+ | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
269
38
 
270
- authenticate <host> <port> <user> <password> <service>
39
+ ## Content
271
40
 
272
- Authenticates to the given authentication server, and use the token in subsequent requests.
41
+ - [Documentation](#documentation)
42
+ - [User documentation](#user-documentation)
43
+ - [Development documentation](#development-documentation)
44
+ - [IoT Agents available](#iot-agents-available)
45
+ - [Install and usage](#install-and-usage)
46
+ - [License](#license)
273
47
 
274
- setProtocol <protocol>
48
+ ## Documentation
275
49
 
276
- Sets the protocol to use in the requests (http or https). Defaults to http.
50
+ This repository contains the common user documentation across all IoT Agents. For particular documentation, you can
51
+ check the specific documentation for each IoT Agent. You can see the a list of available IoT Agents in the
52
+ [IoT Agents available](#iot-agents-available) section.
277
53
 
278
- configMigration <host> <port> <originDb>
54
+ ### User documentation
279
55
 
280
- Sets the configuration for a migration between a C++ IoTA and a Node.js one.
56
+ - [Getting started](doc/getting-started.md)
57
+ - [IoT Agent API](doc/api.md)
58
+ - [Administration manual](doc/admin.md)
59
+ - [Deprecated features](doc/deprecated.md)
60
+ - [Roadmap](doc/roadmap.md)
281
61
 
282
- showConfigMigration
62
+ ### Development documentation
283
63
 
284
- Shows the current migration configuration.
64
+ - [Development manual](doc/devel/development.md)
65
+ - [Contributing guide](doc/devel/contribution-guidelines.md)
66
+ - [Architecture](doc/devel/architecture.md)
67
+ - [North Port - NGSI Interactions](doc/devel/northboundinteractions.md)
285
68
 
286
- addProtocols <protocols>
69
+ ## IoT Agents available
287
70
 
288
- Add a protocol translation table, in the following format:
289
- protocolOrigin1=protocolTarget1;protocolOrigin2=protocolTarget2...
71
+ The following IoT Agents using the **IoT Agent Node Lib** are available:
290
72
 
73
+ - [IoT Agent JSON](https://github.com/telefonicaid/iotagent-json) - a bridge between HTTP/MQTT messaging (with a JSON
74
+ payload) and NGSI
75
+ - [IoT Agent Ultralight](https://github.com/telefonicaid/iotagent-ul) - a bridge between HTTP/MQTT messaging
76
+ - [IoT Agent LWM2M](https://github.com/telefonicaid/lightweightm2m-iotagent) - a bridge between the
77
+ [Lightweight M2M](https://www.omaspecworks.org/what-is-oma-specworks/iot/lightweight-m2m-lwm2m/) protocol and NGSI
78
+ (with an UltraLight2.0 payload) and NGSI
79
+ - [IoT Agent for Sigfox](https://github.com/telefonicaid/sigfox-iotagent) - a bridge between the
80
+ [Sigfox](https://www.sigfox.com/en) protocol and NGSI
81
+ - [IoT Agent for LoRaWAN](https://github.com/Atos-Research-and-Innovation/IoTagent-LoRaWAN) - a bridge between the
82
+ [LoRaWAN](https://www.thethingsnetwork.org/docs/lorawan/) protocol and NGSI
83
+ - [IoT Agent for OPC-UA](https://github.com/Engineering-Research-and-Development/iotagent-opcua) - a bridge between
84
+ the [OPC Unified Architecture](http://www.opcua.us/) protocol and NGSI
85
+ - [IoT Agent for ISOXML](https://github.com/FIWARE/iotagent-isoxml) - a bridge between the ISOXML/ADAPT protocol for
86
+ agricultural machinery and NGSI
291
87
 
292
- migrate <targetDb> <service> <subservice>
88
+ ## Install and usage
293
89
 
294
- Migrate all the devices and services for the selected service and subservice into the
295
- specified Mongo database. To perform the migration for all the services or all the
296
- subservices, use the "*" value.
297
- ```
90
+ The **IoT Agent node library** is not a standalone product. If you plan to install and use any of the IoT Agents
91
+ available, you should follow the installation instructions for each IoT Agent (find the link in the
92
+ [previous section](#iot-agents-available)). You can find the common API provided by the **IoT Agent node library** under
93
+ [API](doc/api.md) documentation.
298
94
 
299
- The agent session stores transient configuration data about the target Context Broker and the target IoT Agent. This
300
- configuration is independent, and can be checked with the `showConfigCb` and `showConfigIot` commands, respectively.
301
- Their values can be changed with the `configCb` and `configIot` commands respectively. The new configurations will be
302
- deleted upon startup.
95
+ If you plan to use the IoT Agent node library in your own project or IoT Agent, you should follow the
96
+ [Developer manual](doc/devel/development.md), which includes the installation instructions and the usage of the library.
303
97
 
304
- ---
98
+ Information about how to configure the IoT agent or the library can be found at the corresponding section of the
99
+ [Administration manual](doc/admin.md).
305
100
 
306
- ## Licence
101
+ ## License
307
102
 
308
103
  The IoT Agent Node Library is licensed under [Affero General Public License (GPL) version 3](./LICENSE).
309
104
 
package/config.js CHANGED
@@ -77,7 +77,9 @@ var config = {
77
77
  providerUrl: 'http://192.168.56.1:4041',
78
78
  deviceRegistrationDuration: 'P1M',
79
79
  defaultType: 'Thing',
80
- expressLimit: '1Mb'
80
+ expressLimit: '1Mb',
81
+ useCBflowControl: false,
82
+ storeLastMeasure: false
81
83
  };
82
84
 
83
85
  module.exports = config;
package/doc/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  - [Getting started](getting-started.md)
6
6
  - [IoT Agent API](api.md)
7
- - [Installation and administration manual](admin.md)
7
+ - [Administration manual](admin.md)
8
8
  - [Deprecated features](deprecated.md)
9
9
  - [Roadmap](roadmap.md)
10
10
 
package/doc/admin.md CHANGED
@@ -5,7 +5,6 @@
5
5
  - [loglevel](#loglevel)
6
6
  - [contextBroker](#contextbroker)
7
7
  - [server](#server)
8
- - [stats](#stats)
9
8
  - [authentication](#authentication)
10
9
  - [deviceRegistry](#deviceregistry)
11
10
  - [mongodb](#mongodb)
@@ -126,9 +125,9 @@ allowing the computer to interpret the rest of the data with more clarity and de
126
125
  ```
127
126
 
128
127
  Under mixed mode, **NGSI v2** payloads are used for context broker communications by default, but this payload may also
129
- be switched to **NGSI LD** at service group or device provisioning time using the `ngsiVersion` field in the
130
- provisioning API. The `ngsiVersion` field switch may be added at either group or device level, with the device level
131
- overriding the group setting.
128
+ be switched to **NGSI LD** at group or device provisioning time using the `ngsiVersion` field in the provisioning API.
129
+ The `ngsiVersion` field switch may be added at either group or device level, with the device level overriding the group
130
+ setting.
132
131
 
133
132
  #### `server`
134
133
 
@@ -159,17 +158,6 @@ support nulls or multi-attribute requests if they are encountered.
159
158
  }
160
159
  ```
161
160
 
162
- #### `stats`
163
-
164
- It configures the periodic collection of statistics. Use `interval` in milliseconds to set the time between stats
165
- writings.
166
-
167
- ```javascript
168
- stats: {
169
- interval: 100;
170
- }
171
- ```
172
-
173
161
  #### `authentication`
174
162
 
175
163
  Stores the authentication data, for use in retrieving tokens for devices with a trust token (required in scenarios with
@@ -318,7 +306,8 @@ added `agentPath`:
318
306
 
319
307
  #### `types`
320
308
 
321
- See **Type Configuration** in the [Configuration API](#configurationapi) section below.
309
+ This parameter includes additional groups configuration as described into the
310
+ [Config group API](api.md#config-group-api) section.
322
311
 
323
312
  #### `service`
324
313
 
@@ -356,7 +345,7 @@ if this flag is activated:
356
345
 
357
346
  #### `defaultResource`
358
347
 
359
- default string to use as resource for the registration of new Configurations (if no resource is provided).
348
+ default string to use as resource for the registration of new config groups (if no resource is provided).
360
349
 
361
350
  #### `defaultKey`
362
351
 
@@ -427,7 +416,38 @@ IotAgents, as all Express applications that use the body-parser middleware, have
427
416
  size that the application will handle. This default limit for ioiotagnets are 1Mb. So, if your IotAgent receives a
428
417
  request with a body that exceeds this limit, the application will throw a “Error: Request entity too large”.
429
418
 
430
- The 1Mb default can be changed setting the `expressLimit` configuration parameter (or equivalente `IOTA_EXPRESS_LIMIT` environment variable).
419
+ The 1Mb default can be changed setting the `expressLimit` configuration parameter (or equivalente `IOTA_EXPRESS_LIMIT`
420
+ environment variable).
421
+
422
+ #### `storeLastMeasure`
423
+
424
+ If this flag is activated, last measure arrived to Device IoTAgent without be processed will be stored in Device under
425
+ `lastMeasure` field (composed of sub-fields `timestamp` and `measure` for the measure itself, in multi-measure format).
426
+ This flag is overwritten by `storeLastMeasure` flag in group or device. This flag is disabled by default.
427
+
428
+ For example in a device document stored in MongoDB will be extended with a subdocument named lastMeasure like this:
429
+
430
+ ```json
431
+ {
432
+ "lastMeasure": {
433
+ "timestamp": "2025-01-09T10:35:33.079Z",
434
+ "measure": [
435
+ [
436
+ {
437
+ "name": "level",
438
+ "type": "Text",
439
+ "value": 33
440
+ }
441
+ ]
442
+ ]
443
+ }
444
+ }
445
+ ```
446
+
447
+ #### `useCBflowControl`
448
+
449
+ If this flag is activated, when iotAgent invokes Context Broker will use [flowControl option](https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/admin/perf_tuning.md#updates-flow-control-mechanism). This flag is overwritten by
450
+ `useCBflowControl` flag in group or device. This flag is disabled by default.
431
451
 
432
452
  ### Configuration using environment variables
433
453
 
@@ -491,6 +511,8 @@ overrides.
491
511
  | IOTA_DEFAULT_ENTITY_NAME_CONJUNCTION | `defaultEntityNameConjunction` |
492
512
  | IOTA_RELAX_TEMPLATE_VALIDATION | `relaxTemplateValidation` |
493
513
  | IOTA_EXPRESS_LIMIT | `expressLimit` |
514
+ | IOTA_STORE_LAST_MEASURE | `storeLastMeasure` |
515
+ | IOTA_CB_FLOW_CONTROL | `useCBflowControl` |
494
516
 
495
517
  Note:
496
518