iotagent-node-lib 3.3.0 → 3.4.1

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 (80) hide show
  1. package/CHANGES_NEXT_RELEASE +1 -0
  2. package/README.md +10 -11
  3. package/doc/README.md +16 -0
  4. package/doc/admin.md +565 -0
  5. package/doc/api.md +9 -5
  6. package/doc/deprecated.md +16 -14
  7. package/doc/{architecture.md → devel/architecture.md} +3 -3
  8. package/doc/{Contribution.md → devel/contribution-guidelines.md} +43 -35
  9. package/doc/devel/development.md +1879 -0
  10. package/doc/{northboundinteractions.md → devel/northboundinteractions.md} +18 -33
  11. package/doc/index.md +3 -5
  12. package/docker/Mosquitto/README.md +1 -0
  13. package/lib/commonConfig.js +0 -5
  14. package/lib/fiware-iotagent-lib.js +1 -1
  15. package/lib/jexlTranformsMap.js +2 -1
  16. package/lib/request-shim.js +2 -2
  17. package/lib/services/commands/commandService.js +1 -1
  18. package/lib/services/common/genericMiddleware.js +1 -1
  19. package/lib/services/devices/deviceRegistryMemory.js +2 -2
  20. package/lib/services/devices/deviceRegistryMongoDB.js +22 -9
  21. package/lib/services/devices/deviceService.js +36 -30
  22. package/lib/services/devices/devices-NGSI-LD.js +14 -2
  23. package/lib/services/devices/devices-NGSI-mixed.js +0 -2
  24. package/lib/services/devices/devices-NGSI-v2.js +22 -100
  25. package/lib/services/groups/groupService.js +1 -1
  26. package/lib/services/ngsi/entities-NGSI-v2.js +14 -27
  27. package/lib/services/northBound/deviceProvisioningServer.js +14 -5
  28. package/mkdocs.yml +6 -11
  29. package/package.json +3 -3
  30. package/scripts/legacy_expression_tool/README.md +56 -38
  31. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +2 -2
  32. package/test/unit/mongodb/mongodb-registry-test.js +1 -1
  33. package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +66 -65
  34. package/test/unit/ngsi-ld/general/https-support-test.js +1 -1
  35. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +8 -7
  36. package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +12 -11
  37. package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +41 -39
  38. package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +122 -122
  39. package/test/unit/ngsi-ld/provisioning/device-registration_test.js +28 -28
  40. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +18 -17
  41. package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +7 -7
  42. package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +8 -7
  43. package/test/unit/ngsiv2/examples/contextRequests/updateContext6.json +2 -0
  44. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +0 -12
  45. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +0 -4
  46. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +1 -5
  47. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +0 -12
  48. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +0 -12
  49. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +0 -4
  50. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +0 -10
  51. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +0 -4
  52. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +0 -4
  53. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +0 -4
  54. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +0 -12
  55. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +0 -4
  56. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +1 -5
  57. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +13 -12
  58. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +2 -2
  59. package/test/unit/ngsiv2/general/https-support-test.js +1 -1
  60. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +3 -8
  61. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +10 -10
  62. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +8 -103
  63. package/test/unit/ngsiv2/provisioning/device-registration_test.js +8 -6
  64. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -1
  65. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -1
  66. package/.nyc_output/33364de2-1199-4ec2-b33c-cae063ef8cc4.json +0 -1
  67. package/.nyc_output/processinfo/33364de2-1199-4ec2-b33c-cae063ef8cc4.json +0 -1
  68. package/.nyc_output/processinfo/index.json +0 -1
  69. package/doc/config-basic-example.js +0 -20
  70. package/doc/development.md +0 -285
  71. package/doc/howto.md +0 -641
  72. package/doc/installationguide.md +0 -365
  73. package/doc/operations.md +0 -127
  74. package/doc/usermanual.md +0 -900
  75. package/lib/plugins/bidirectionalData.js +0 -356
  76. package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +0 -697
  77. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +0 -536
  78. /package/doc/{NorthboundInteractions.postman_collection → devel/NorthboundInteractions.postman_collection} +0 -0
  79. /package/doc/{echo.js → devel/echo.js} +0 -0
  80. /package/doc/{finalResult.js → devel/finalResult.js} +0 -0
@@ -1,365 +0,0 @@
1
- # Installation & Administration Guide
2
-
3
- ## Configuration
4
-
5
- The `activate()` function that starts the IoT Agent receives as single parameter with the configuration for the IoT
6
- Agent. The Agent Console reads the same configuration from the `config.js` file.
7
-
8
- ### Global Configuration
9
-
10
- These are the parameters that can be configured in the global section:
11
-
12
- - **logLevel**: minimum log level to log. May take one of the following values: DEBUG, INFO, ERROR, FATAL. E.g.:
13
- 'DEBUG'.
14
- - **contextBroker**: connection data to the Context Broker (host and port). E.g.:
15
-
16
- ```javascript
17
- {
18
- host: '192.168.56.101',
19
- port: '1026'
20
- }
21
- ```
22
-
23
- - If you want to use **NGSI v2**:
24
-
25
- ```javascript
26
- {
27
- host: '192.168.56.101',
28
- port: '1026',
29
- ngsiVersion: 'v2'
30
- }
31
- ```
32
-
33
- - If you want to use **NGSI-LD** (experimental):
34
-
35
- ```javascript
36
- {
37
- host: '192.168.56.101',
38
- port: '1026',
39
- ngsiVersion: 'ld',
40
- jsonLdContext: 'http://context.json-ld' // or ['http://context1.json-ld','http://context2.json-ld'] if you need more than one
41
- }
42
- ```
43
-
44
- Where `http://context.json-ld` is the location of the NGSI-LD `@context` element which provides additional information
45
- allowing the computer to interpret the rest of the data with more clarity and depth. Read the
46
- [JSON-LD specification](https://w3c.github.io/json-ld-syntax/#the-context) for more information.
47
-
48
- - If you want to support a "mixed" mode with both **NGSI-v2** and **NGSI-LD** (experimental):
49
-
50
- ```javascript
51
- {
52
- host: '192.168.56.101',
53
- port: '1026',
54
- ngsiVersion: 'mixed',
55
- jsonLdContext: 'http://context.json-ld' // or ['http://context1.json-ld','http://context2.json-ld'] if you need more than one
56
- }
57
- ```
58
-
59
- Under mixed mode, **NGSI v2** payloads are used for context broker communications by default, but this payload may also
60
- be switched to **NGSI LD** at service group or device provisioning time using the `ngsiVersion` field in the
61
- provisioning API. The `ngsiVersion` field switch may be added at either group or device level, with the device level
62
- overriding the group setting.
63
-
64
- - **server**: configuration used to create the Context Server (port where the IoT Agent will be listening as a Context
65
- Provider and base root to prefix all the paths). The `port` attribute is required. If no `baseRoot` attribute is
66
- used, '/' is used by default. E.g.:
67
-
68
- ```javascript
69
- {
70
- baseRoot: '/',
71
- port: 4041
72
- }
73
- ```
74
-
75
- When connected to an **NGSI-LD** context broker, an IoT Agent is able to indicate whether it is willing to accept `null`
76
- values and also whether it is able to process the **NGSI-LD** `datasetId` metadata element. Setting these values to
77
- `false` will cause the IoT Agent to return a 400 **Bad Request** HTTP status code explaining that the IoT Agent does not
78
- support nulls or multi-attribute requests if they are encountered.
79
-
80
- ```javascript
81
- {
82
- baseRoot: '/',
83
- port: 4041,
84
- ldSupport : {
85
- null: true,
86
- datasetId: true
87
- }
88
- }
89
- ```
90
-
91
- - **stats**: configure the periodic collection of statistics. Use `interval` in milliseconds to set the time between
92
- stats writings.
93
-
94
- ```javascript
95
- stats: {
96
- interval: 100;
97
- }
98
- ```
99
-
100
- - **authentication**: authentication data, for use in retrieving tokens for devices with a trust token (required in
101
- scenarios with security enabled in the Context Broker side). Currently, two authentication provider are supported:
102
- `keystone` and `oauth2`. Authentication need to be enabled by setting the field `enabled` to `true`. In `keystone`
103
- based authentication, the `trust` associated to the `device` or `deviceGroup` is a token representing a specific
104
- user and his rights on a given domain (i.e. combination of `fiware-service` and `fiware-servicepath`). The
105
- authentication process use the trust delegation workflow to check if the trust provided is valid, in which case
106
- return a `x-subject-token` that can be used to authenticate the request to the Context Broker. Required parameters
107
- are: the `url` of the keystone to be used (alternatively `host` and `port` but if you use this combination, the IoT
108
- Agent will assume that the protocol is HTTP), the `user` and `password` to which it is delegated the `trust`
109
- verification. E.g.:
110
-
111
- ```javascript
112
- {
113
- enabled: true,
114
- url: 'https://localhost:5000',
115
- type: 'keystone',
116
- user: 'iotagent',
117
- password: 'iotagent'
118
- }
119
- ```
120
-
121
- In `oauth2` based authentication, two types of tokens can be used depending on the availability in the IDM to be used.
122
- On one hand, the `trust` associated to the `device` or `deviceGroup` is a `refresh_token` issued by a specific user for
123
- the Context Broker client. The authentication process uses the
124
- [`refresh_token` grant type](https://tools.ietf.org/html/rfc6749#section-1.5) to obtain an `access_token` that can be
125
- used to authenticate the request to the Context Broker. At the time being the assumption is that the `refresh_token` is
126
- a not expiring `offline_token` (we believe this is the best solution in the case of IoT Devices, since injecting a
127
- refresh token look may slow down communication. Still, the developer would be able to invalidate the refresh token on
128
- the provider side in case of security issues connected to a token). The code was tested using
129
- [Keycloak](http://www.keycloak.org), [Auth0](https://auth0.com) and [FIWARE Keyrock](https://github.com/ging/fiware-idm)
130
- (it may require customisation for other providers - while OAuth2 is a standard, not all implementations behave in the
131
- same way, especially as regards status codes and error messages). Required parameters are: the `url` of the OAuth 2
132
- provider to be used (alternatively `host` and `port` but if you use this combination, the IoT Agent will assume that the
133
- protocol is HTTP), the `tokenPath` to which the validation request should be sent
134
- (`/auth/realms/default/protocol/openid-connect/token` for Keycloak and Auth0, `/oauth2/token` for Keyrock), the
135
- `clientId` and `clientSecret` that identify the Context Broker, and the `header` field that should be used to send the
136
- authentication request (that will be sent in the form `Authorization: Bearer <access_token>`). E.g.:
137
-
138
- ```javascript
139
- {
140
- enabled: true,
141
- type: 'oauth2',
142
- url: 'http://localhost:3000',
143
- header: 'Authorization',
144
- clientId: 'context-broker',
145
- clientSecret: 'c8d58d16-0a42-400e-9765-f32e154a5a9e',
146
- tokenPath: '/auth/realms/default/protocol/openid-connect/token'
147
- }
148
- ```
149
-
150
- Nevertheless, this kind of authentication relying on `refresh_token` grant type implies that when the acces_token
151
- expires, it is needed to request a new one from the IDM, causing some overhead in the communication with the Context
152
- Broker. To mitigate this issue, FIWARE KeyRock IDM implements `permanent tokens` that can be retrieved using
153
- `scope=permanent`. With this approach, the IOTA does not need to interact with the IDM and directly include the
154
- `permanent token` in the header. In order to use this type of token, an additional parameter `permanentToken` must be
155
- set to `true` in the `authentication` configuration. An environment variable `IOTA_AUTH_PERMANENT_TOKEN` can be also
156
- used for the same purpose. For instance:
157
-
158
- ```javascript
159
- {
160
- type: 'oauth2',
161
- url: 'http://localhost:3000',
162
- header: 'Authorization',
163
- clientId: 'context-broker',
164
- clientSecret: '0c2492e1-3ce3-4cca-9723-e6075b89c244',
165
- tokenPath: '/oauth2/token',
166
- enabled: true,
167
- permanentToken: true
168
- }
169
- ```
170
-
171
- - **deviceRegistry**: type of Device Registry to create. Currently, two values are supported: `memory` and `mongodb`.
172
- If the former is configured, a transient memory-based device registry will be used to register all the devices. This
173
- registry will be emptied whenever the process is restarted. If the latter is selected, a MongoDB database will be
174
- used to store all the device information, so it will be persistent from one execution to the other. Mongodb
175
- databases must be configured in the `mongob` section (as described bellow). E.g.:
176
-
177
- ```javascript
178
- {
179
- type: 'mongodb';
180
- }
181
- ```
182
-
183
- - **mongodb**: configures the MongoDB driver for those repositories with 'mongodb' type. If the `host` parameter is a
184
- list of comma-separated IPs, they will be considered to be part of a Replica Set. In that case, the optional
185
- property `replicaSet` should contain the Replica Set name. If the database requires authentication, username
186
- (`username`), password (`password`) and authSource (`authSource`) can be set. If the database requires TLS/SSL
187
- connection but any validation of the certificate chain is not mandatory, all you need is to set the ssl (`ssl`)
188
- option as `true` to connect the database. If you need to add more complex option(s) such as `retryWrites=true` or
189
- `w=majority` when connection database, extraArgs (`extraArgs`) can be used to perform it. For The MongoBD driver
190
- will retry the connection at startup time `retries` times, waiting `retryTime` seconds between attempts, if those
191
- attributes are present (default values are 5 and 5 respectively). E.g.:
192
-
193
- ```javascript
194
- {
195
- host: 'localhost',
196
- port: '27017',
197
- db: 'iotagent',
198
- retries: 5,
199
- retryTime: 5
200
- }
201
- ```
202
-
203
- ```javascript
204
- {
205
- host: 'mongodb-0,mongodb-1,mongodb-2',
206
- port: '27017',
207
- db: 'iotagent',
208
- replicaSet: 'rs0',
209
- user: 'rootuser',
210
- password: 'password',
211
- authSource: 'admin',
212
- ssl: true,
213
- extraArgs: {
214
- retryWrites: true,
215
- readPreference: 'nearest',
216
- w: 'majority'
217
- },
218
- retries: 5,
219
- retryTime: 5
220
- }
221
- ```
222
-
223
- - **iotManager**: configures all the information needed to register the IoT Agent in the IoTManager. If this section
224
- is present, the IoTA will try to register to a IoTAM in the `host`, `port` and `path` indicated, with the
225
- information configured in the object. The IoTAgent URL that will be reported will be the `providedUrl` (described
226
- below) with the added `agentPath`:
227
-
228
- ```javascript
229
- {
230
- host: 'mockediotam.com',
231
- port: 9876,
232
- path: '/protocols',
233
- protocol: 'GENERIC_PROTOCOL',
234
- description: 'A generic protocol',
235
- agentPath: '/iot'
236
- }
237
- ```
238
-
239
- - **types**: See **Type Configuration** in the [Configuration API](#configurationapi) section below.
240
- - **eventType**: Default type for the Events (useful only with the `addEvents` plugin).
241
- - **service**: default service for the IoT Agent. If a device is being registered, and no service information comes
242
- with the device data, and no service information is configured for the given type, the default IoT agent service
243
- will be used instead. E.g.: 'smartGondor'.
244
- - **subservice**: default subservice for the IoT Agent. If a device is being registered, and no subservice information
245
- comes with the device data, and no subservice information is configured for the given type, the default IoT agent
246
- subservice will be used instead. E.g.: '/gardens'.
247
- - **providerUrl**: URL to send in the Context Provider registration requests. Should represent the external IP of the
248
- deployed IoT Agent (the IP where the Context Broker will redirect the NGSI requests). E.g.:
249
- 'http://192.168.56.1:4041'.
250
- - **iotaVersion**: indicates the version of the IoTA that will be displayed in the about method (it should be filled
251
- automatically by each IoTA).
252
- - **dieOnUnexpectedError**: if this flag is activated, the IoTAgent will not capture global exception, thus dying upon
253
- any unexpected error.
254
- - **singleConfigurationMode**: enables the Single Configuration mode for backwards compatibility (see description in
255
- the Overview). Default to false.
256
- - **timestamp**: if this flag is activated:
257
- - For NGSI-v2, the IoT Agent will add a `TimeInstant` metadata attribute to all the attributes updated from device
258
- information. This flag is overwritten by `timestamp` flag in group or device
259
- - With NGSI-LD, the standard `observedAt` property-of-a-property is created instead.
260
- - **defaultResource**: default string to use as resource for the registration of new Configurations (if no resource is
261
- provided).
262
- - **defaultKey**: default string to use as API Key for devices that do not belong to a particular Configuration.
263
- - **componentName**: default string identifying the component name for this IoT Agent in the logs.
264
- - **pollingExpiration**: expiration time for commands waiting in the polling queue in miliseconds. If a command has
265
- been in the queue for this amount of time without being collected by the device, the expiration daemon will reclaim
266
- it. This attribute is optional (if it doesn't exist, commands won't expire).
267
- - **pollingDaemonFrequency**: time between collection of expired commands in milliseconds. This attribute is optional
268
- (if this parameter doesn't exist the polling daemon won't be started).
269
- - **autocast**: When enabled, the IoT Agents will try to cast attribute's values considering the JSON native type
270
- (only for NGSI v2).
271
- - **multiCore**: When enabled, the IoT Agents runs in multi-thread environment to take advantage of multi-core
272
- systems. It allows two values `true` or `false`. This attribute is optional with default to false, which means that
273
- the IoTAgent runs in a single thread. For more details about multi-core functionality, please refer to the
274
- [Cluster](https://nodejs.org/api/cluster.html) module in Node.js and
275
- [this section](howto.md#iot-agent-in-multi-thread-mode) of the library documentation.
276
- - **fallbackTenant** - For Linked Data Context Brokers which do not support multi-tenancy, this provides an
277
- alternative mechanism for supplying the `NGSILD-Tenant` header. Note that NGSILD-Tenant has not yet been included in
278
- the NGSI-LD standard (it has been proposed for the next update of the standard, but the final decision has yet been
279
- confirmed), take into account it could change. Note that for backwards compatibility with NGSI v2, the
280
- `fiware-service` header is already used as alternative if the `NGSILD-Tenant` header is not supplied.
281
- - **fallbackPath** - For Linked Data Context Brokers which do not support a service path, this provides an alternative
282
- mechanism for suppling the `NGSILD-Path` header. Note that for backwards compatibility with NGSI v2, the
283
- `fiware-servicepath` header is already used as alternative if the `NGSILD-Path` header is not supplied. Note that
284
- NGSILD-Path has not yet been included in the NGSI-LD standard (it has been proposed for the next update of the
285
- standard, but the final decision has yet been confirmed), take into account it could change
286
- - **explicitAttrs**: if this flag is activated, only provisioned attributes will be processed to Context Broker. This
287
- flag is overwritten by `explicitAttrs` flag in group or device provision. Additionally `explicitAttrs` can be used
288
- to define which meassures defined in JSON/JEXL array will be propagated to NGSI interface.
289
- - **defaultEntityNameConjunction**: the default conjunction string used to compose a default `entity_name` when is not
290
- provided at device provisioning time; in that case `entity_name` is composed by `type` + `:` + `device_id`. Default
291
- value is `:`. This value is overwritten by `defaultEntityNameConjunction` in group provision.
292
- - **relaxTemplateValidation**: if this flag is activated, `objectId` attributes for incoming devices are not
293
- validated, and may exceptionally include characters (such as semi-colons) which are
294
- [forbidden](https://fiware-orion.readthedocs.io/en/master/user/forbidden_characters/index.html) according to the
295
- NGSI specification. When provisioning devices, it is necessary that the developer provides valid `objectId`-`name`
296
- mappings whenever relaxed mode is used, to prevent the consumption of forbidden characters.
297
-
298
- ### Configuration using environment variables
299
-
300
- Some of the configuration parameters can be overriden with environment variables, to ease the use of those parameters
301
- with container-based technologies, like Docker, Heroku, etc...
302
-
303
- The following table shows the accepted environment variables, as well as the configuration parameter the variable
304
- overrides.
305
-
306
- | Environment variable | Configuration attribute |
307
- | :----------------------------------- | :------------------------------ |
308
- | IOTA_CB_URL | `contextBroker.url` |
309
- | IOTA_CB_HOST | `contextBroker.host` |
310
- | IOTA_CB_PORT | `contextBroker.port` |
311
- | IOTA_CB_NGSI_VERSION | `contextBroker.ngsiVersion` |
312
- | IOTA_NORTH_HOST | `server.host` |
313
- | IOTA_NORTH_PORT | `server.port` |
314
- | IOTA_LD_SUPPORT_NULL | `server.ldSupport.null` |
315
- | IOTA_LD_SUPPORT_DATASET_ID | `server.ldSupport.datasetId` |
316
- | IOTA_PROVIDER_URL | `providerUrl` |
317
- | IOTA_AUTH_ENABLED | `authentication.enabled` |
318
- | IOTA_AUTH_TYPE | `authentication.type` |
319
- | IOTA_AUTH_HEADER | `authentication.header` |
320
- | IOTA_AUTH_URL | `authentication.url` |
321
- | IOTA_AUTH_HOST | `authentication.host` |
322
- | IOTA_AUTH_PORT | `authentication.port` |
323
- | IOTA_AUTH_USER | `authentication.user` |
324
- | IOTA_AUTH_PASSWORD | `authentication.password` |
325
- | IOTA_AUTH_CLIENT_ID | `authentication.clientId` |
326
- | IOTA_AUTH_CLIENT_SECRET | `authentication.clientSecret` |
327
- | IOTA_AUTH_TOKEN_PATH | `authentication.tokenPath` |
328
- | IOTA_AUTH_PERMANENT_TOKEN | `authentication.permanentToken` |
329
- | IOTA_REGISTRY_TYPE | `deviceRegistry.type` |
330
- | IOTA_LOG_LEVEL | `logLevel` |
331
- | IOTA_TIMESTAMP | `timestamp` |
332
- | IOTA_IOTAM_URL | `iotManager.url` |
333
- | IOTA_IOTAM_HOST | `iotManager.host` |
334
- | IOTA_IOTAM_PORT | `iotManager.port` |
335
- | IOTA_IOTAM_PATH | `iotManager.path` |
336
- | IOTA_IOTAM_AGENTPATH | `iotManager.agentPath` |
337
- | IOTA_IOTAM_PROTOCOL | `iotManager.protocol` |
338
- | IOTA_IOTAM_DESCRIPTION | `iotManager.description` |
339
- | IOTA_MONGO_HOST | `mongodb.host` |
340
- | IOTA_MONGO_PORT | `mongodb.port` |
341
- | IOTA_MONGO_DB | `mongodb.db` |
342
- | IOTA_MONGO_REPLICASET | `mongodb.replicaSet` |
343
- | IOTA_MONGO_USER | `mongodb.user` |
344
- | IOTA_MONGO_PASSWORD | `mongodb.password` |
345
- | IOTA_MONGO_AUTH_SOURCE | `mongodb.authSource` |
346
- | IOTA_MONGO_RETRIES | `mongodb.retries` |
347
- | IOTA_MONGO_RETRY_TIME | `mongodb.retryTime` |
348
- | IOTA_MONGO_SSL | `mongodb.ssl` |
349
- | IOTA_MONGO_EXTRAARGS | `mongodb.extraArgs` |
350
- | IOTA_SINGLE_MODE | `singleConfigurationMode` |
351
- | IOTA_POLLING_EXPIRATION | `pollingExpiration` |
352
- | IOTA_POLLING_DAEMON_FREQ | `pollingDaemonFrequency` |
353
- | IOTA_AUTOCAST | `autocast` |
354
- | IOTA_MULTI_CORE | `multiCore` |
355
- | IOTA_JSON_LD_CONTEXT | `jsonLdContext` |
356
- | IOTA_FALLBACK_TENANT | `fallbackTenant` |
357
- | IOTA_FALLBACK_PATH | `fallbackPath` |
358
- | IOTA_EXPLICIT_ATTRS | `explicitAttrs` |
359
- | IOTA_DEFAULT_ENTITY_NAME_CONJUNCTION | `defaultEntityNameConjunction` |
360
- | IOTA_RELAX_TEMPLATE_VALIDATION | `relaxTemplateValidation` |
361
-
362
- Note:
363
-
364
- - If you need to pass more than one JSON-LD context, you can define the IOTA_JSON_LD_CONTEXT environment variable as a
365
- comma separated list of contexts (e.g. `'http://context1.json-ld,http://context2.json-ld'`)
package/doc/operations.md DELETED
@@ -1,127 +0,0 @@
1
- # Operations Manual: logs and alarms
2
-
3
- - [Logs](#logs)
4
- - [Alarms](#alarms)
5
- - [Error naming code](#error-naming-code)
6
-
7
- The following document shows all the errors that can appear in an IoT Agent using this library, and gives a brief idea
8
- of the severity and how to react to those errors.
9
-
10
- ## Logs
11
-
12
- The following section contains the error log entries that can appear in the IoT Agents logs, grouped by category.
13
-
14
- ##### GENERAL-001 Couldn't find callback in listDevices() call.
15
-
16
- ##### MONGODB-001: Error trying to connect to MongoDB: %s
17
-
18
- Implies there has been an error connecting with the DB. The component will automatically retry from this error, but it
19
- may be a sign of connectivity problems between the DB and the component. If the connection cannot be restablished from
20
- this error, a MONGODB-002 error will be raised.
21
-
22
- ##### MONGODB-002: Error found after [%d] attempts: %s
23
-
24
- Indicates that it was impossible to establish a connection to the MongoDB cluster, even after retrying N times. This
25
- could be caused by a connectivity problem with the MongoDB machine, a problem in the MongoDB cluster, or a
26
- misconfiguration of the IoTA Manager. Check the conectivity, the state of the MongoDB cluster and the Mongo
27
- configuration data.
28
-
29
- ##### MONGODB-003: No host found for MongoDB driver.
30
-
31
- This error will thrown if MongoDB is selected as the configured repository for data but some information is missing in
32
- the configuration file. Check the configuration file and add all the required information.
33
-
34
- ##### MONGODB-004: MongoDB connection was lost.
35
-
36
- Indicates that it was impossible to reestablish the connection with the MongoDB server after retrying N times. This
37
- could be caused by a connectivity problem with the MongoDB machine or by changes on the configuration of the MongoDB
38
- server done while the IoT Agent was running. This error is only thrown when using a single MongoDB instance or when
39
- using sharding but just a single mongos proxy. When using MongoDB instances using replica sets or multiple mongos
40
- servers, the IoT Agent will retry connecting forever alternating between the different nodes.
41
-
42
- ##### IOTAM-001: Error updating information in the IOTAM. Status Code [%d]
43
-
44
- The IoT Agent could not contact the IoT Agent manager to update its information. This condition may indicate a lack of
45
- connectivity between machines or a problem in the IoT Agent Manager. The IoT Agent information in the IoT Agent Manager
46
- will be out-of-date until this problem is solved.
47
-
48
- ##### KEYSTONE-001: Error retrieving token from Keystone: %s
49
-
50
- There was connection error connecting with Keystone to retrieve a token. This condition may indicate a lack of
51
- connectivity between both machines or a problem with Keystone.
52
-
53
- ##### KEYSTONE-002: Unexpected status code: %d
54
-
55
- There was a problem retrieving a token from keystone that was not caused by connectivity errors. Check the Keystone log
56
- for errors and the security configuration in the IoTAgent. This may also be caused by a wrong trust token used by the
57
- user.
58
-
59
- ##### KEYSTONE-003: Token missing in the response headers.
60
-
61
- Authentication flow worked correctly, but the response headers did not include the expected header `x-subject-token`.
62
- Check the Keystone logs and configuration.
63
-
64
- ##### OAUTH2-001: Error retrieving token from OAuth2 provider: %s
65
-
66
- There was connection error connecting with OAuth2 provider to retrieve a token. This condition may indicate a lack of
67
- connectivity between both machines or a problem with OAuth2 provider.
68
-
69
- ##### OAUTH2-002: Unexpected status code: %d
70
-
71
- There was a problem retrieving a token from OAuth2 provider that was not caused by connectivity errors. Check the OAuth2
72
- provider log for errors and the security configuration in the IoTAgent. This may also be caused by an invalid
73
- `refresh_token` used by the user.
74
-
75
- ##### OAUTH2-003: Token missing in the response body
76
-
77
- The JSON response body returned by the OAuth2 provider does not include a field `access_token`. Check the OAuth2 logs
78
- and configuration.
79
-
80
- ##### ORION-001: Connection error creating initial entity in the Context Broker: %s
81
-
82
- There was a connectivity error accessing Context Broker to create an initial entity (or the Context Broker was down).
83
- Check connectivity between the machines, the status of the remote Context Broker and the configuration of the IoTAgent.
84
-
85
- ##### ORION-002: Connection error sending registrations to the Context Broker: %s
86
-
87
- There was a connectivity error accessing Context Broker to register the IoTA as a Context Provider (or the Context
88
- Broker was down). Check connectivity between the machines, the status of the remote Context Broker and the configuration
89
- of the IoT Agent.
90
-
91
- ##### VALIDATION-FATAL-001: Validation Request templates not found
92
-
93
- Validation templates were not found. Check all the validation templates are properly located in the IoTAgent Library
94
- folder and that the file permissions are correct.
95
-
96
- ## Alarms
97
-
98
- The following table shows the alarms that can be raised in the IoTAgent library. All the alarms are signaled by a error
99
- log starting with the prefix "Raising [%s]:" (where %s is the alarm name). All the alarms are released by an info log
100
- with the prefix "Releasing [%s]". These texts appear in the `msg=` field of the generic log record format.
101
-
102
- | Alarm name | Severity | Description |
103
- | :------------- | :----------- | :------------------------------------------------------- |
104
- | MONGO-ALARM_XX | **Critical** | Indicates an error in the MongoDB connectivity |
105
- | ORION-ALARM | **Critical** | Indicates a persistent error accesing the Context Broker |
106
- | IOTAM-ALARM | **Critical** | Indicates a persistent error accessing the IoTAM |
107
-
108
- while the 'Severity' criterium is as follows:
109
-
110
- - **Critical** - The system is not working
111
- - **Major** - The system has a problem that degrades the service and must be addressed
112
- - **Warning** - It is happening something that must be notified
113
-
114
- In order to identify the internal flow which origins a mongo alarm, there is a suffix `_XX` which identifies from `01` to
115
- `11` each flow.
116
-
117
- ## Error naming code
118
-
119
- Every error has a code composed of a prefix and an ID, codified with the following table:
120
-
121
- | Prefix | Type of operation |
122
- | :--------------- | :--------------------------------------------------------- |
123
- | MONGODB | Errors related with the MongoDB repository |
124
- | IOTAM | Errors related with the IoTA Manager |
125
- | KEYSTONE | Errors related with trust token retrieval |
126
- | ORION | Errors in Context Broker access |
127
- | VALIDATION-FATAL | Errors related with management of the Validation templates |