iotagent-node-lib 4.4.0 → 4.6.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.
- package/README.md +67 -272
- package/config.js +2 -1
- package/doc/README.md +1 -1
- package/doc/admin.md +19 -22
- package/doc/api.md +621 -155
- package/doc/deprecated.md +4 -0
- package/doc/devel/architecture.md +5 -135
- package/doc/devel/development.md +224 -12
- package/doc/getting-started.md +114 -53
- package/doc/requirements.txt +1 -1
- package/doc/roadmap.md +5 -5
- package/docker/Mosquitto/Dockerfile +2 -2
- package/docker/Mosquitto/README.md +14 -11
- package/lib/commonConfig.js +7 -1
- package/lib/constants.js +3 -0
- package/lib/fiware-iotagent-lib.js +12 -15
- package/lib/jexlTranformsMap.js +3 -1
- package/lib/model/dbConn.js +1 -4
- package/lib/services/common/alarmManagement.js +3 -0
- package/lib/services/devices/deviceRegistryMemory.js +1 -1
- package/lib/services/devices/deviceRegistryMongoDB.js +2 -2
- package/lib/services/devices/deviceService.js +4 -3
- package/lib/services/devices/devices-NGSI-LD.js +5 -5
- package/lib/services/devices/devices-NGSI-mixed.js +3 -3
- package/lib/services/devices/devices-NGSI-v2.js +5 -5
- package/lib/services/groups/groupService.js +1 -1
- package/lib/services/ngsi/entities-NGSI-LD.js +321 -571
- package/lib/services/ngsi/entities-NGSI-v2.js +348 -281
- package/lib/services/ngsi/ngsiService.js +3 -1
- package/lib/services/ngsi/subscription-NGSI-LD.js +2 -2
- package/lib/services/ngsi/subscription-NGSI-v2.js +2 -2
- package/lib/services/northBound/deviceGroupAdministrationServer.js +42 -6
- package/lib/services/northBound/deviceProvisioningServer.js +5 -5
- package/lib/services/northBound/northboundServer.js +4 -2
- package/lib/services/stats/statsRegistry.js +128 -101
- package/lib/templates/createDevice.json +0 -24
- package/lib/templates/createDeviceLax.json +0 -23
- package/lib/templates/deviceGroup.json +1 -25
- package/lib/templates/updateDevice.json +0 -24
- package/lib/templates/updateDeviceLax.json +0 -23
- package/package.json +2 -2
- package/scripts/legacy_expression_tool/README.md +0 -1
- package/test/functional/README.md +75 -47
- package/test/functional/functional-tests-runner.js +9 -4
- package/test/functional/functional-tests.js +4 -4
- package/test/functional/testCases.js +1251 -257
- package/test/functional/testUtils.js +53 -20
- package/test/unit/examples/deviceProvisioningRequests/provisionFullDevice.json +1 -13
- package/test/unit/examples/deviceProvisioningRequests/updateProvisionDeviceWithApikey.json +4 -0
- package/test/unit/examples/groupProvisioningRequests/multipleConfigGroupsCreation.json +44 -0
- package/test/unit/examples/groupProvisioningRequests/provisionDuplicateConfigGroup.json +35 -0
- package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroup.json +36 -0
- package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroupAlternate.json +36 -0
- package/test/unit/general/deviceService-test.js +102 -0
- package/test/unit/general/statistics-service_test.js +1 -74
- package/test/unit/mongodb/mongodb-configGroup-registry-test.js +452 -0
- package/test/unit/mongodb/mongodb-connectionoptions-test.js +2 -3
- package/test/unit/mongodb/mongodb-group-registry-test.js +34 -33
- package/test/unit/mongodb/mongodb-service-registry-test.js +477 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +4 -4
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin2.json +22 -22
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +4 -4
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +14 -15
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin1.json +23 -23
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +0 -5
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin4.json +11 -16
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin5.json +23 -28
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin6.json +8 -13
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin7.json +0 -5
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin8.json +24 -29
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +12 -17
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextStaticLinkedAttributes.json +12 -10
- package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +0 -102
- package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +4 -5
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +5 -5
- package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +0 -4
- package/test/unit/ngsiv2/general/deviceService-test.js +94 -1
- package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +195 -0
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +259 -0
- package/test/unit/ngsiv2/provisioning/device-provisioning-configGroup-api_test.js +1189 -0
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +6 -6
- package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +0 -4
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +35 -0
- package/test/unit/statsRegistry/openmetrics-test.js +167 -0
- package/lib/templates/queryContext.json +0 -25
- package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +0 -35
- package/test/unit/examples/deviceProvisioningRequests/provisionDeviceBidirectionalGroup.json +0 -17
- package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +0 -31
- package/test/unit/general/statistics-persistence_test.js +0 -121
- package/test/unit/ngsi-ld/examples/contextRequests/createBidirectionalDevice.json +0 -17
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextProcessTimestamp.json +0 -12
- package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
- package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithDatasetId.json +0 -21
- package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -17
- package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -23
- package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +0 -132
- package/test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json +0 -8
- package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
- package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -19
- package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -24
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# FIWARE IoT Agent Node
|
|
1
|
+
# FIWARE IoT Agent Node Library
|
|
2
2
|
|
|
3
3
|
[](https://www.fiware.org/developers/catalogue/)
|
|
4
4
|
[](https://opensource.org/licenses/AGPL-3.0)
|
|
@@ -10,300 +10,95 @@
|
|
|
10
10
|

|
|
11
11
|
[](https://bestpractices.coreinfrastructure.org/projects/4671)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
39
|
+
## Content
|
|
271
40
|
|
|
272
|
-
|
|
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
|
-
|
|
48
|
+
## Documentation
|
|
275
49
|
|
|
276
|
-
|
|
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
|
-
|
|
54
|
+
### User documentation
|
|
279
55
|
|
|
280
|
-
|
|
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
|
-
|
|
62
|
+
### Development documentation
|
|
283
63
|
|
|
284
|
-
|
|
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
|
-
|
|
69
|
+
## IoT Agents available
|
|
287
70
|
|
|
288
|
-
|
|
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
|
-
|
|
88
|
+
## Install and usage
|
|
293
89
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
300
|
-
|
|
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
|
-
##
|
|
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
package/doc/README.md
CHANGED
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,7 +125,7 @@ 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
|
|
128
|
+
be switched to **NGSI LD** at group or device provisioning time using the `ngsiVersion` field in the
|
|
130
129
|
provisioning API. The `ngsiVersion` field switch may be added at either group or device level, with the device level
|
|
131
130
|
overriding the group setting.
|
|
132
131
|
|
|
@@ -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
|
|
@@ -260,13 +248,13 @@ the `mongob` section (as described bellow). E.g.:
|
|
|
260
248
|
|
|
261
249
|
It configures the MongoDB driver for those repositories with 'mongodb' type. If the `host` parameter is a list of
|
|
262
250
|
comma-separated IPs, they will be considered to be part of a Replica Set. In that case, the optional property
|
|
263
|
-
`replicaSet` should contain the Replica Set name. If the database requires authentication, username (`user`),
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
251
|
+
`replicaSet` should contain the Replica Set name. If the database requires authentication, username (`user`), password
|
|
252
|
+
(`password`) and authSource (`authSource`) can be set. If the database requires TLS/SSL connection but any validation of
|
|
253
|
+
the certificate chain is not mandatory, all you need is to set the ssl (`ssl`) option as `true` to connect the database.
|
|
254
|
+
If you need to add more complex option(s) such as `retryWrites=true` or `w=majority` when connection database, extraArgs
|
|
255
|
+
(`extraArgs`) can be used to perform it. For The MongoBD driver will retry the connection at startup time `retries`
|
|
256
|
+
times, waiting `retryTime` seconds between attempts, if those attributes are present (default values are 5 and 5
|
|
257
|
+
respectively). E.g.:
|
|
270
258
|
|
|
271
259
|
```javascript
|
|
272
260
|
{
|
|
@@ -318,7 +306,7 @@ added `agentPath`:
|
|
|
318
306
|
|
|
319
307
|
#### `types`
|
|
320
308
|
|
|
321
|
-
|
|
309
|
+
This parameter includes additional groups configuration as described into the [Config group API](api.md#config-group-api) section.
|
|
322
310
|
|
|
323
311
|
#### `service`
|
|
324
312
|
|
|
@@ -356,7 +344,7 @@ if this flag is activated:
|
|
|
356
344
|
|
|
357
345
|
#### `defaultResource`
|
|
358
346
|
|
|
359
|
-
default string to use as resource for the registration of new
|
|
347
|
+
default string to use as resource for the registration of new config groups (if no resource is provided).
|
|
360
348
|
|
|
361
349
|
#### `defaultKey`
|
|
362
350
|
|
|
@@ -421,6 +409,14 @@ characters (such as semi-colons) which are
|
|
|
421
409
|
specification. When provisioning devices, it is necessary that the developer provides valid `objectId`-`name` mappings
|
|
422
410
|
whenever relaxed mode is used, to prevent the consumption of forbidden characters.
|
|
423
411
|
|
|
412
|
+
#### `expressLimit`
|
|
413
|
+
|
|
414
|
+
IotAgents, as all Express applications that use the body-parser middleware, have a default limit to the request body
|
|
415
|
+
size that the application will handle. This default limit for ioiotagnets are 1Mb. So, if your IotAgent receives a
|
|
416
|
+
request with a body that exceeds this limit, the application will throw a “Error: Request entity too large”.
|
|
417
|
+
|
|
418
|
+
The 1Mb default can be changed setting the `expressLimit` configuration parameter (or equivalente `IOTA_EXPRESS_LIMIT` environment variable).
|
|
419
|
+
|
|
424
420
|
### Configuration using environment variables
|
|
425
421
|
|
|
426
422
|
Some of the configuration parameters can be overriden with environment variables, to ease the use of those parameters
|
|
@@ -482,6 +478,7 @@ overrides.
|
|
|
482
478
|
| IOTA_EXPLICIT_ATTRS | `explicitAttrs` |
|
|
483
479
|
| IOTA_DEFAULT_ENTITY_NAME_CONJUNCTION | `defaultEntityNameConjunction` |
|
|
484
480
|
| IOTA_RELAX_TEMPLATE_VALIDATION | `relaxTemplateValidation` |
|
|
481
|
+
| IOTA_EXPRESS_LIMIT | `expressLimit` |
|
|
485
482
|
|
|
486
483
|
Note:
|
|
487
484
|
|