iotagent-node-lib 2.18.0 → 2.21.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/.github/workflows/ci.yml +1 -2
- package/.nyc_output/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
- package/.nyc_output/processinfo/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.readthedocs.yml +3 -1
- package/CHANGES_NEXT_RELEASE +1 -0
- package/README.md +5 -56
- package/doc/advanced-topics.md +121 -85
- package/doc/api.md +63 -54
- package/doc/development.md +8 -9
- package/doc/expressionLanguage.md +517 -316
- package/doc/installationguide.md +66 -64
- package/doc/northboundinteractions.md +40 -33
- package/doc/requirements.txt +4 -0
- package/{docs → doc}/roadmap.md +21 -6
- package/doc/usermanual.md +50 -18
- package/docker/Mosquitto/Dockerfile +28 -11
- package/docker/Mosquitto/README.md +8 -6
- package/docker/Mosquitto/startMosquitto.sh +14 -4
- package/lib/fiware-iotagent-lib.js +4 -2
- package/lib/jexlTranformsMap.js +11 -1
- package/lib/model/Device.js +4 -1
- package/lib/model/Group.js +19 -1
- package/lib/plugins/expressionParser.js +6 -4
- package/lib/plugins/expressionPlugin.js +63 -22
- package/lib/plugins/jexlParser.js +3 -1
- package/lib/plugins/multiEntity.js +2 -21
- package/lib/request-shim.js +111 -0
- package/lib/services/common/domain.js +6 -2
- package/lib/services/common/genericMiddleware.js +6 -2
- package/lib/services/common/iotManagerService.js +1 -1
- package/lib/services/common/securityServiceKeystone.js +1 -1
- package/lib/services/common/securityServiceOAuth2.js +3 -2
- package/lib/services/devices/deviceRegistryMemory.js +13 -2
- package/lib/services/devices/deviceRegistryMongoDB.js +16 -7
- package/lib/services/devices/deviceService.js +26 -2
- package/lib/services/devices/devices-NGSI-LD.js +1 -1
- package/lib/services/devices/devices-NGSI-v2.js +2 -6
- package/lib/services/devices/registrationUtils.js +0 -2
- package/lib/services/ngsi/entities-NGSI-LD.js +97 -11
- package/lib/services/ngsi/entities-NGSI-v2.js +95 -8
- package/lib/services/ngsi/ngsiService.js +5 -4
- package/lib/services/northBound/contextServer-NGSI-LD.js +3 -2
- package/lib/services/northBound/contextServer-NGSI-v2.js +32 -27
- package/lib/services/northBound/contextServerUtils.js +1 -1
- package/lib/services/northBound/deviceProvisioningServer.js +31 -6
- package/lib/services/northBound/northboundServer.js +2 -0
- package/lib/services/northBound/restUtils.js +1 -1
- package/lib/templates/createDevice.json +12 -0
- package/lib/templates/updateDevice.json +12 -0
- package/package.json +9 -15
- package/test/tools/utils.js +2 -0
- package/test/unit/expressions/jexlExpression-test.js +5 -5
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +1 -1
- package/test/unit/general/deviceService-test.js +2 -5
- package/test/unit/general/loglevel-api_test.js +6 -11
- package/test/unit/general/startup-test.js +1 -0
- package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +1 -0
- package/test/unit/mongodb/mongodb-group-registry-test.js +1 -1
- package/test/unit/mongodb/mongodb-registry-test.js +2 -1
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin12a.json +7 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin13.json +13 -13
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin31.json +15 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +17 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin33.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin34.json +17 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4a.json +36 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin7.json +16 -16
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin8a.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
- package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1018 -0
- package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +2 -2
- package/test/unit/ngsi-ld/general/deviceService-test.js +1 -1
- package/test/unit/ngsi-ld/general/https-support-test.js +2 -1
- package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +2 -1
- package/test/unit/ngsi-ld/general/startup-test.js +1 -0
- package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
- package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +2 -1
- package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +2 -6
- package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +1 -0
- package/test/unit/ngsi-ld/ngsiService/autocast-test.js +1 -0
- package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +1 -0
- package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +4 -3
- package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +1 -0
- package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +3 -2
- package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +61 -0
- package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +2 -1
- package/test/unit/ngsi-ld/provisioning/device-registration_test.js +3 -2
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +42 -54
- package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +2 -1
- package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +4 -4
- package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +3 -5
- package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +12 -18
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin17.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +16 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +22 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +25 -0
- package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +4 -4
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +561 -0
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +3 -2
- package/test/unit/ngsiv2/general/deviceService-test.js +9 -8
- package/test/unit/ngsiv2/general/https-support-test.js +2 -1
- package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +2 -1
- package/test/unit/ngsiv2/general/startup-test.js +1 -0
- package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +2 -1
- package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +14 -18
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +3 -1
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +1 -0
- package/test/unit/ngsiv2/ngsiService/queryDeviceInformationInCb-test.js +0 -1
- package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +4 -3
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +3 -2
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +210 -0
- package/test/unit/ngsiv2/plugins/translation-inPlugins_test.js +1 -1
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +3 -2
- package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +2 -1
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +2 -1
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +3 -2
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +4 -3
- package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +42 -53
- package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +2 -1
- package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +4 -4
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +3 -4
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +13 -19
- package/test/unit/plugins/capture-configuration-inPlugins_test.js +3 -1
- package/test/unit/plugins/capture-provision-inPlugins_test.js +2 -1
- package/bin/agentConsole.js +0 -257
- package/bin/iotAgentTester.js +0 -44
- package/lib/command/commandLine.js +0 -918
- package/lib/command/migration.js +0 -176
- package/test/unit/general/migration-test.js +0 -256
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin20.json +0 -25
package/doc/installationguide.md
CHANGED
|
@@ -56,9 +56,10 @@ allowing the computer to interpret the rest of the data with more clarity and de
|
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Under mixed mode, **NGSI v2** payloads are used for context broker communications by default, but this payload may also
|
|
60
|
-
to **NGSI LD** at service group or device provisioning time using the `ngsiVersion` field in the
|
|
61
|
-
The `ngsiVersion` field switch may be added at either group or device level, with the device level
|
|
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.
|
|
62
63
|
|
|
63
64
|
- **server**: configuration used to create the Context Server (port where the IoT Agent will be listening as a Context
|
|
64
65
|
Provider and base root to prefix all the paths). The `port` attribute is required. If no `baseRoot` attribute is
|
|
@@ -159,7 +160,7 @@ used for the same purpose. For instance:
|
|
|
159
160
|
|
|
160
161
|
```javascript
|
|
161
162
|
{
|
|
162
|
-
type:
|
|
163
|
+
type: 'mongodb';
|
|
163
164
|
}
|
|
164
165
|
```
|
|
165
166
|
|
|
@@ -241,8 +242,8 @@ used for the same purpose. For instance:
|
|
|
241
242
|
- **singleConfigurationMode**: enables the Single Configuration mode for backwards compatibility (see description in
|
|
242
243
|
the Overview). Default to false.
|
|
243
244
|
- **timestamp**: if this flag is activated:
|
|
244
|
-
- For NGSI-v2, the IoT Agent will add a `TimeInstant` metadata attribute to all the attributes updated from
|
|
245
|
-
|
|
245
|
+
- For NGSI-v2, the IoT Agent will add a `TimeInstant` metadata attribute to all the attributes updated from device
|
|
246
|
+
information. This flag is overwritten by `timestamp` flag in group or device
|
|
246
247
|
- With NGSI-LD, the standard `observedAt` property-of-a-property is created instead.
|
|
247
248
|
- **defaultResource**: default string to use as resource for the registration of new Configurations (if no resource is
|
|
248
249
|
provided).
|
|
@@ -273,10 +274,11 @@ used for the same purpose. For instance:
|
|
|
273
274
|
NGSILD-Path has not yet been included in the NGSI-LD standard (it has been proposed for the next update of the
|
|
274
275
|
standard, but the final decision has yet been confirmed), take into account it could change
|
|
275
276
|
- **explicitAttrs**: if this flag is activated, only provisioned attributes will be processed to Context Broker. This
|
|
276
|
-
flag is overwritten by `explicitAttrs` flag in group or device provision.
|
|
277
|
+
flag is overwritten by `explicitAttrs` flag in group or device provision. Additionally `explicitAttrs` can be used
|
|
278
|
+
to define which meassures defined in JSON/JEXL array will be propagated to NGSI interface.
|
|
277
279
|
- **defaultEntityNameConjunction**: the default conjunction string used to compose a default `entity_name` when is not
|
|
278
|
-
provided at device provisioning time; in that case `entity_name` is composed by `type` + `:` + `device_id`.
|
|
279
|
-
|
|
280
|
+
provided at device provisioning time; in that case `entity_name` is composed by `type` + `:` + `device_id`. Default
|
|
281
|
+
value is `:`. This value is overwritten by `defaultEntityNameConjunction` in group provision.
|
|
280
282
|
- **relaxTemplateValidation**: if this flag is activated, `objectId` attributes for incoming devices are not
|
|
281
283
|
validated, and may exceptionally include characters (such as semi-colons) which are
|
|
282
284
|
[forbidden](https://fiware-orion.readthedocs.io/en/master/user/forbidden_characters/index.html) according to the
|
|
@@ -291,61 +293,61 @@ with container-based technologies, like Docker, Heroku, etc...
|
|
|
291
293
|
The following table shows the accepted environment variables, as well as the configuration parameter the variable
|
|
292
294
|
overrides.
|
|
293
295
|
|
|
294
|
-
| Environment variable
|
|
295
|
-
|
|
|
296
|
-
| IOTA_CB_URL
|
|
297
|
-
| IOTA_CB_HOST
|
|
298
|
-
| IOTA_CB_PORT
|
|
299
|
-
| IOTA_CB_NGSI_VERSION
|
|
300
|
-
| IOTA_NORTH_HOST
|
|
301
|
-
| IOTA_NORTH_PORT
|
|
302
|
-
| IOTA_PROVIDER_URL
|
|
303
|
-
| IOTA_AUTH_ENABLED
|
|
304
|
-
| IOTA_AUTH_TYPE
|
|
305
|
-
| IOTA_AUTH_HEADER
|
|
306
|
-
| IOTA_AUTH_URL
|
|
307
|
-
| IOTA_AUTH_HOST
|
|
308
|
-
| IOTA_AUTH_PORT
|
|
309
|
-
| IOTA_AUTH_USER
|
|
310
|
-
| IOTA_AUTH_PASSWORD
|
|
311
|
-
| IOTA_AUTH_CLIENT_ID
|
|
312
|
-
| IOTA_AUTH_CLIENT_SECRET
|
|
313
|
-
| IOTA_AUTH_TOKEN_PATH
|
|
314
|
-
| IOTA_AUTH_PERMANENT_TOKEN
|
|
315
|
-
| IOTA_REGISTRY_TYPE
|
|
316
|
-
| IOTA_LOG_LEVEL
|
|
317
|
-
| IOTA_TIMESTAMP
|
|
318
|
-
| IOTA_IOTAM_URL
|
|
319
|
-
| IOTA_IOTAM_HOST
|
|
320
|
-
| IOTA_IOTAM_PORT
|
|
321
|
-
| IOTA_IOTAM_PATH
|
|
322
|
-
| IOTA_IOTAM_AGENTPATH
|
|
323
|
-
| IOTA_IOTAM_PROTOCOL
|
|
324
|
-
| IOTA_IOTAM_DESCRIPTION
|
|
325
|
-
| IOTA_MONGO_HOST
|
|
326
|
-
| IOTA_MONGO_PORT
|
|
327
|
-
| IOTA_MONGO_DB
|
|
328
|
-
| IOTA_MONGO_REPLICASET
|
|
329
|
-
| IOTA_MONGO_USER
|
|
330
|
-
| IOTA_MONGO_PASSWORD
|
|
331
|
-
| IOTA_MONGO_AUTH_SOURCE
|
|
332
|
-
| IOTA_MONGO_RETRIES
|
|
333
|
-
| IOTA_MONGO_RETRY_TIME
|
|
334
|
-
| IOTA_MONGO_SSL
|
|
335
|
-
| IOTA_MONGO_EXTRAARGS
|
|
336
|
-
| IOTA_SINGLE_MODE
|
|
337
|
-
| IOTA_APPEND_MODE
|
|
338
|
-
| IOTA_POLLING_EXPIRATION
|
|
339
|
-
| IOTA_POLLING_DAEMON_FREQ
|
|
340
|
-
| IOTA_AUTOCAST
|
|
341
|
-
| IOTA_MULTI_CORE
|
|
342
|
-
| IOTA_JSON_LD_CONTEXT
|
|
343
|
-
| IOTA_FALLBACK_TENANT
|
|
344
|
-
| IOTA_FALLBACK_PATH
|
|
345
|
-
| IOTA_DEFAULT_EXPRESSION_LANGUAGE
|
|
346
|
-
| IOTA_EXPLICIT_ATTRS
|
|
347
|
-
| IOTA_DEFAULT_ENTITY_NAME_CONJUNCTION | `defaultEntityNameConjunction`
|
|
348
|
-
| IOTA_RELAX_TEMPLATE_VALIDATION
|
|
296
|
+
| Environment variable | Configuration attribute |
|
|
297
|
+
| :----------------------------------- | :------------------------------ |
|
|
298
|
+
| IOTA_CB_URL | `contextBroker.url` |
|
|
299
|
+
| IOTA_CB_HOST | `contextBroker.host` |
|
|
300
|
+
| IOTA_CB_PORT | `contextBroker.port` |
|
|
301
|
+
| IOTA_CB_NGSI_VERSION | `contextBroker.ngsiVersion` |
|
|
302
|
+
| IOTA_NORTH_HOST | `server.host` |
|
|
303
|
+
| IOTA_NORTH_PORT | `server.port` |
|
|
304
|
+
| IOTA_PROVIDER_URL | `providerUrl` |
|
|
305
|
+
| IOTA_AUTH_ENABLED | `authentication.enabled` |
|
|
306
|
+
| IOTA_AUTH_TYPE | `authentication.type` |
|
|
307
|
+
| IOTA_AUTH_HEADER | `authentication.header` |
|
|
308
|
+
| IOTA_AUTH_URL | `authentication.url` |
|
|
309
|
+
| IOTA_AUTH_HOST | `authentication.host` |
|
|
310
|
+
| IOTA_AUTH_PORT | `authentication.port` |
|
|
311
|
+
| IOTA_AUTH_USER | `authentication.user` |
|
|
312
|
+
| IOTA_AUTH_PASSWORD | `authentication.password` |
|
|
313
|
+
| IOTA_AUTH_CLIENT_ID | `authentication.clientId` |
|
|
314
|
+
| IOTA_AUTH_CLIENT_SECRET | `authentication.clientSecret` |
|
|
315
|
+
| IOTA_AUTH_TOKEN_PATH | `authentication.tokenPath` |
|
|
316
|
+
| IOTA_AUTH_PERMANENT_TOKEN | `authentication.permanentToken` |
|
|
317
|
+
| IOTA_REGISTRY_TYPE | `deviceRegistry.type` |
|
|
318
|
+
| IOTA_LOG_LEVEL | `logLevel` |
|
|
319
|
+
| IOTA_TIMESTAMP | `timestamp` |
|
|
320
|
+
| IOTA_IOTAM_URL | `iotManager.url` |
|
|
321
|
+
| IOTA_IOTAM_HOST | `iotManager.host` |
|
|
322
|
+
| IOTA_IOTAM_PORT | `iotManager.port` |
|
|
323
|
+
| IOTA_IOTAM_PATH | `iotManager.path` |
|
|
324
|
+
| IOTA_IOTAM_AGENTPATH | `iotManager.agentPath` |
|
|
325
|
+
| IOTA_IOTAM_PROTOCOL | `iotManager.protocol` |
|
|
326
|
+
| IOTA_IOTAM_DESCRIPTION | `iotManager.description` |
|
|
327
|
+
| IOTA_MONGO_HOST | `mongodb.host` |
|
|
328
|
+
| IOTA_MONGO_PORT | `mongodb.port` |
|
|
329
|
+
| IOTA_MONGO_DB | `mongodb.db` |
|
|
330
|
+
| IOTA_MONGO_REPLICASET | `mongodb.replicaSet` |
|
|
331
|
+
| IOTA_MONGO_USER | `mongodb.user` |
|
|
332
|
+
| IOTA_MONGO_PASSWORD | `mongodb.password` |
|
|
333
|
+
| IOTA_MONGO_AUTH_SOURCE | `mongodb.authSource` |
|
|
334
|
+
| IOTA_MONGO_RETRIES | `mongodb.retries` |
|
|
335
|
+
| IOTA_MONGO_RETRY_TIME | `mongodb.retryTime` |
|
|
336
|
+
| IOTA_MONGO_SSL | `mongodb.ssl` |
|
|
337
|
+
| IOTA_MONGO_EXTRAARGS | `mongodb.extraArgs` |
|
|
338
|
+
| IOTA_SINGLE_MODE | `singleConfigurationMode` |
|
|
339
|
+
| IOTA_APPEND_MODE | `appendMode` |
|
|
340
|
+
| IOTA_POLLING_EXPIRATION | `pollingExpiration` |
|
|
341
|
+
| IOTA_POLLING_DAEMON_FREQ | `pollingDaemonFrequency` |
|
|
342
|
+
| IOTA_AUTOCAST | `autocast` |
|
|
343
|
+
| IOTA_MULTI_CORE | `multiCore` |
|
|
344
|
+
| IOTA_JSON_LD_CONTEXT | `jsonLdContext` |
|
|
345
|
+
| IOTA_FALLBACK_TENANT | `fallbackTenant` |
|
|
346
|
+
| IOTA_FALLBACK_PATH | `fallbackPath` |
|
|
347
|
+
| IOTA_DEFAULT_EXPRESSION_LANGUAGE | `defaultExpressionLanguage` |
|
|
348
|
+
| IOTA_EXPLICIT_ATTRS | `explicitAttrs` |
|
|
349
|
+
| IOTA_DEFAULT_ENTITY_NAME_CONJUNCTION | `defaultEntityNameConjunction` |
|
|
350
|
+
| IOTA_RELAX_TEMPLATE_VALIDATION | `relaxTemplateValidation` |
|
|
349
351
|
|
|
350
352
|
Note:
|
|
351
353
|
|
|
@@ -163,16 +163,15 @@ The equivalent **NGSI-LD** payload is associated to an update operation (PATCH `
|
|
|
163
163
|
|
|
164
164
|
```json
|
|
165
165
|
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
"temperature": {
|
|
167
|
+
"type": "Property",
|
|
168
|
+
"value": "23"
|
|
169
|
+
},
|
|
170
|
+
"pressure": {
|
|
171
|
+
"type": "Property",
|
|
172
|
+
"value": "720"
|
|
173
|
+
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
175
|
```
|
|
177
176
|
|
|
178
177
|
#### R1 - UpdateContext (response)
|
|
@@ -285,7 +284,8 @@ This is an **NGSI-LD** response to `/ngsi-ld/v1/entities/<entity>`
|
|
|
285
284
|
```
|
|
286
285
|
|
|
287
286
|
In this case, the response to the QueryContext is a list of responses, one for each requested entity, indicating whether
|
|
288
|
-
the information has been retrieved successfully (in the HTTP Status code) and the requested Context information in the
|
|
287
|
+
the information has been retrieved successfully (in the HTTP Status code) and the requested Context information in the
|
|
288
|
+
body of the response.
|
|
289
289
|
|
|
290
290
|
Application level errors can be specified for each entity in this payload.
|
|
291
291
|
|
|
@@ -305,7 +305,7 @@ Context Element, but with the request as a whole.
|
|
|
305
305
|
|
|
306
306
|
### Scenario 1: active attributes
|
|
307
307
|
|
|
308
|
-

|
|
309
309
|
|
|
310
310
|
In this scenario, the interaction is started by the device, that is going to actively send a piece of data to the
|
|
311
311
|
platform. When the IoTAgent receives the data, it sends it to the Context Broker through a P1 request. The Context
|
|
@@ -319,7 +319,7 @@ updating process, and can occur at any time (they are to completely different pr
|
|
|
319
319
|
|
|
320
320
|
### Scenario 2: lazy attributes
|
|
321
321
|
|
|
322
|
-

|
|
323
323
|
|
|
324
324
|
This scenario requires that the attributes that are going to be requested are marked as provided by the IoT Agent,
|
|
325
325
|
through a registration process (NGSIv9). Examples of this registration process will be provided in the practical section
|
|
@@ -345,7 +345,7 @@ queries (and thus P2 and R2 payloads).
|
|
|
345
345
|
|
|
346
346
|
### Scenario 3: commands
|
|
347
347
|
|
|
348
|
-

|
|
349
349
|
|
|
350
350
|
This scenario requires that the attributes that are going to be requested are marked as provided by the IoT Agent,
|
|
351
351
|
through a registration process (NGSIv9). Examples of this registration process will be provided in the practical section
|
|
@@ -359,15 +359,26 @@ use three kinds of attributes:
|
|
|
359
359
|
- An attribute will be used as the _input attribute_ (the attribute registered in the Context Provider). This input
|
|
360
360
|
attribute can be thought of as a command issued to the IoTAgent (from here the name of the scenario) whose value is
|
|
361
361
|
the set of arguments of the command. Only updateContext operations will be used to interact with this attributes.
|
|
362
|
+
Typically this attribute is of type `command`.
|
|
362
363
|
|
|
363
364
|
- Another attribute will be used as the _result attribute_. This attribute will be updated from the IoTAgent, and its
|
|
364
365
|
value stored in the Context Broker. This attribute will contain the result of the command (this result can be
|
|
365
366
|
information in case the command was a "information retrieval" command or the result of an action if it was an
|
|
366
|
-
"actuator command"). Typically, the name of this attribute will be the same of the
|
|
367
|
-
additional sufix (`_info`)
|
|
367
|
+
"actuator command"). Initially its value is empty. Typically, the name of this attribute will be the same of the
|
|
368
|
+
input attribute, with an additional sufix (`_info`) and the type is `commandResult`.
|
|
368
369
|
|
|
369
370
|
- Another attribute with the same characteristics as the later will be used to indicate whether the command has ended
|
|
370
|
-
successfully or whether an error has been reported.
|
|
371
|
+
successfully or whether an error has been reported. Typically, the name of this attribute will be the same of the
|
|
372
|
+
input attribute, with an additional sufix (`_status`) and the type is `commandStatus`. The possible values of this
|
|
373
|
+
attribute are: `ERROR`, `EXPIRED`, `PENDING`, `DELIVERED`, `UNKNOWN` with the following meanings:
|
|
374
|
+
- ERROR: There is a kind of error.
|
|
375
|
+
- EXPIRED: This meens that pull command has been expired without be delivered to device according with
|
|
376
|
+
`pollingExpiration` time defined by config.
|
|
377
|
+
- PENDING: In a PUSH command means that command has been sent to device but not device has still not respond. In a
|
|
378
|
+
PULL command means that command has been stored and device still has no ask for it.
|
|
379
|
+
- DELIVERED: The command has been delivered to phisical device.
|
|
380
|
+
- OK: The command has been delivered and device has respond.
|
|
381
|
+
- UNKNOWN: This is the initial value.
|
|
371
382
|
|
|
372
383
|
In this scenario, the interaction is also initiated by the User. The user starts the scenario by sending an update
|
|
373
384
|
request P1 to the Context Broker, to the input attribute (1). The Context Broker redirects this same payload to the
|
|
@@ -835,7 +846,6 @@ The IoT Agent detects the selected attribute is a command, and replies to the Co
|
|
|
835
846
|
```json
|
|
836
847
|
[
|
|
837
848
|
{
|
|
838
|
-
|
|
839
849
|
"type": "device",
|
|
840
850
|
"id": "Dev0001",
|
|
841
851
|
"switch": {
|
|
@@ -854,7 +864,6 @@ The Context Broker, forwards the same response to the user, thus replying the or
|
|
|
854
864
|
```json
|
|
855
865
|
[
|
|
856
866
|
{
|
|
857
|
-
|
|
858
867
|
"type": "device",
|
|
859
868
|
"id": "Dev0001",
|
|
860
869
|
"switch": {
|
|
@@ -882,11 +891,11 @@ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -
|
|
|
882
891
|
"isPattern": "false",
|
|
883
892
|
"id": "Dev0001",
|
|
884
893
|
"switch_info": {
|
|
885
|
-
"type": "
|
|
894
|
+
"type": "commandResult",
|
|
886
895
|
"value": "Switched successfully!"
|
|
887
896
|
},
|
|
888
897
|
"switch_status": {
|
|
889
|
-
"type": "
|
|
898
|
+
"type": "commandStatus",
|
|
890
899
|
"value": "OK"
|
|
891
900
|
}
|
|
892
901
|
}
|
|
@@ -906,11 +915,11 @@ The Context Broker replies to the IoT Agent with a R1 payload (200 OK):
|
|
|
906
915
|
"type": "device",
|
|
907
916
|
"id": "Dev0001",
|
|
908
917
|
"switch_info": {
|
|
909
|
-
"type": "
|
|
918
|
+
"type": "commandResult",
|
|
910
919
|
"value": ""
|
|
911
920
|
},
|
|
912
|
-
"switch_status":
|
|
913
|
-
"type": "
|
|
921
|
+
"switch_status": {
|
|
922
|
+
"type": "commandStatus",
|
|
914
923
|
"value": ""
|
|
915
924
|
}
|
|
916
925
|
}
|
|
@@ -936,8 +945,8 @@ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -
|
|
|
936
945
|
}
|
|
937
946
|
],
|
|
938
947
|
"attributes": [
|
|
939
|
-
|
|
940
|
-
|
|
948
|
+
"switch_info",
|
|
949
|
+
"switch_status"
|
|
941
950
|
]
|
|
942
951
|
}' "https://<platform-ip>:10027/v2/op/query"
|
|
943
952
|
```
|
|
@@ -947,20 +956,18 @@ The Context Broker replies with all the desired data, in R2 format (200 OK):
|
|
|
947
956
|
```json
|
|
948
957
|
[
|
|
949
958
|
{
|
|
950
|
-
|
|
951
959
|
"type": "device",
|
|
952
960
|
"id": "Dev0001",
|
|
953
961
|
"switch_info": {
|
|
954
|
-
"type": "
|
|
962
|
+
"type": "commandResult",
|
|
955
963
|
"value": "Switched successfully!"
|
|
956
964
|
},
|
|
957
965
|
"switch_status": {
|
|
958
|
-
"type": "
|
|
966
|
+
"type": "commandStatus",
|
|
959
967
|
"value": "OK"
|
|
960
968
|
}
|
|
961
969
|
}
|
|
962
970
|
]
|
|
963
|
-
|
|
964
971
|
```
|
|
965
972
|
|
|
966
973
|
### Scenario 3: commands (error)
|
|
@@ -978,11 +985,11 @@ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -
|
|
|
978
985
|
"isPattern": "false",
|
|
979
986
|
"id": "Dev0001",
|
|
980
987
|
"switch_info":{
|
|
981
|
-
"type": "
|
|
988
|
+
"type": "commandResult",
|
|
982
989
|
"value": "The switch could not be switched due to the following error: switch blocked"
|
|
983
990
|
},
|
|
984
991
|
"switch_status":{
|
|
985
|
-
"type": "
|
|
992
|
+
"type": "commandStatus",
|
|
986
993
|
"value": "ERROR"
|
|
987
994
|
}
|
|
988
995
|
}
|
|
@@ -999,11 +1006,11 @@ In this case, the Context Broker reply with the following response (200 OK):
|
|
|
999
1006
|
"type": "device",
|
|
1000
1007
|
"id": "Dev0001",
|
|
1001
1008
|
"switch_info": {
|
|
1002
|
-
"type": "
|
|
1009
|
+
"type": "commandResult",
|
|
1003
1010
|
"value": ""
|
|
1004
1011
|
},
|
|
1005
1012
|
"switch_status": {
|
|
1006
|
-
"type": "
|
|
1013
|
+
"type": "commandStatus",
|
|
1007
1014
|
"value": ""
|
|
1008
1015
|
}
|
|
1009
1016
|
}
|
package/{docs → doc}/roadmap.md
RENAMED
|
@@ -13,7 +13,7 @@ only, and this section may be revised to provide newer information at any time.
|
|
|
13
13
|
|
|
14
14
|
Disclaimer:
|
|
15
15
|
|
|
16
|
-
- This section has been last updated in March
|
|
16
|
+
- This section has been last updated in March 2022. Please take into account its content could be obsolete.
|
|
17
17
|
- Note we develop this software in Agile way, so development plan is continuously under review. Thus, this roadmap has
|
|
18
18
|
to be understood as rough plan of features to be done along time which is fully valid only at the time of writing
|
|
19
19
|
it. This roadmap has not be understood as a commitment on features and/or dates.
|
|
@@ -25,19 +25,17 @@ Disclaimer:
|
|
|
25
25
|
The following list of features are planned to be addressed in the short term, and incorporated in a release of the
|
|
26
26
|
product:
|
|
27
27
|
|
|
28
|
-
- Selectively ignore measure in the southbound interface (community)
|
|
29
|
-
- JEXL support in expressions (community)
|
|
30
28
|
- cgroup literal in configuration groups management API (community)
|
|
31
29
|
- Metadata processing improvements
|
|
32
|
-
-
|
|
30
|
+
- Improve command functionalities (binary data + expression + mapping)
|
|
33
31
|
|
|
34
32
|
### Medium term
|
|
35
33
|
|
|
36
34
|
The following list of features are planned to be addressed in the medium term, typically within the subsequent
|
|
37
35
|
release(s) generated in the next 9 months after the next planned release:
|
|
38
36
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
37
|
+
- Accept JEXL Expressions for entity name in autoprovisioned devices (#1145)
|
|
38
|
+
- Refactor entities-NGSI-v2.js module (#1166)
|
|
41
39
|
|
|
42
40
|
### Long term
|
|
43
41
|
|
|
@@ -48,3 +46,20 @@ us if you wish to get involved in the implementation or influence the roadmap:
|
|
|
48
46
|
- Incremental introduccion of ECMAScript6 syntax (previous analysis of which sub-set of interesting aspect we want to
|
|
49
47
|
take)
|
|
50
48
|
- Use the lightweight ingestion mechanism for connection oriented updates implemented in Context Broker
|
|
49
|
+
- Add support to other transport protocols (BacNET, Modbus, etc)
|
|
50
|
+
|
|
51
|
+
### Features already completed
|
|
52
|
+
|
|
53
|
+
The following list contains all features that were in the roadmap and have already been implemented.
|
|
54
|
+
|
|
55
|
+
- Support for "delta" measures (i.e. "temperature _increased_ in 5 degress" instead of "temperature _is_ 25")
|
|
56
|
+
- Allow to handle binary messages ([iota-ul#530](https://github.com/telefonicaid/iotagent-ul/issues/530))
|
|
57
|
+
- Removal support for NGSIv1 (#966) ([2.18.0](https://github.com/telefonicaid/iotagent-node-lib/releases/tag/2.18.0))
|
|
58
|
+
- Selectively ignore measure in the southbound interface
|
|
59
|
+
([iotagent-json#416](https://github.com/telefonicaid/iotagent-json/issues/416),
|
|
60
|
+
[iotagent-ul#372](https://github.com/telefonicaid/iotagent-ul/issues/372))
|
|
61
|
+
([2.13.0](https://github.com/telefonicaid/iotagent-node-lib/releases/tag/2.13.0))
|
|
62
|
+
- JEXL support in expressions (#801, #687, #868)
|
|
63
|
+
([2.13.0](https://github.com/telefonicaid/iotagent-node-lib/releases/tag/2.13.0))
|
|
64
|
+
- Add MongoDB authentication support (#844)
|
|
65
|
+
([2.12.0](https://github.com/telefonicaid/iotagent-node-lib/releases/tag/2.12.0))
|
package/doc/usermanual.md
CHANGED
|
@@ -25,7 +25,7 @@ More values will be added in the future to the library. The applications using t
|
|
|
25
25
|
Registry just by using the following function:
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
|
-
iotagentLib.statsRegistry.add(
|
|
28
|
+
iotagentLib.statsRegistry.add('statName', statIncrementalValue, callback);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
The first time this function is invoked, it will add the new stat to the registry. Subsequent calls will add the value
|
|
@@ -80,7 +80,7 @@ In order to use the library, add the following dependency to your package.json f
|
|
|
80
80
|
In order to use this library, first you must require it:
|
|
81
81
|
|
|
82
82
|
```javascript
|
|
83
|
-
var iotagentLib = require(
|
|
83
|
+
var iotagentLib = require('iotagent-node-lib');
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
The library supports four groups of features, one for each direction of the communication: client-to-server and
|
|
@@ -209,8 +209,8 @@ function setCommandResult(entityName, resource, apikey, commandName, commandResu
|
|
|
209
209
|
###### Description
|
|
210
210
|
|
|
211
211
|
Update the result of a command in the Context Broker. The result of the command has two components: the result of the
|
|
212
|
-
command itself will be represented with the suffix `
|
|
213
|
-
with the `
|
|
212
|
+
command itself will be represented with the suffix `_info` in the entity while the status is updated in the attribute
|
|
213
|
+
with the `_status` suffix.
|
|
214
214
|
|
|
215
215
|
###### Params
|
|
216
216
|
|
|
@@ -265,16 +265,16 @@ Once all the updates have taken place, the callback must be invoked with the upd
|
|
|
265
265
|
|
|
266
266
|
```javascript
|
|
267
267
|
callback(null, {
|
|
268
|
-
type:
|
|
268
|
+
type: 'TheType',
|
|
269
269
|
isPattern: false,
|
|
270
|
-
id:
|
|
270
|
+
id: 'EntityID',
|
|
271
271
|
attributes: [
|
|
272
272
|
{
|
|
273
|
-
name:
|
|
274
|
-
type:
|
|
275
|
-
value:
|
|
276
|
-
}
|
|
277
|
-
]
|
|
273
|
+
name: 'lumniscence',
|
|
274
|
+
type: 'Lumens',
|
|
275
|
+
value: '432'
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
278
|
});
|
|
279
279
|
```
|
|
280
280
|
|
|
@@ -303,16 +303,16 @@ The callback must be invoked with the updated Context Element, using the informa
|
|
|
303
303
|
|
|
304
304
|
```javascript
|
|
305
305
|
callback(null, {
|
|
306
|
-
type:
|
|
306
|
+
type: 'TheType',
|
|
307
307
|
isPattern: false,
|
|
308
|
-
id:
|
|
308
|
+
id: 'EntityID',
|
|
309
309
|
attributes: [
|
|
310
310
|
{
|
|
311
|
-
name:
|
|
312
|
-
type:
|
|
313
|
-
value:
|
|
314
|
-
}
|
|
315
|
-
]
|
|
311
|
+
name: 'lumniscence',
|
|
312
|
+
type: 'Lumens',
|
|
313
|
+
value: '432'
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
316
|
});
|
|
317
317
|
```
|
|
318
318
|
|
|
@@ -686,6 +686,38 @@ unexpectedly dead, a new process is created automatically to keep always the max
|
|
|
686
686
|
- iotAgent: The IoT Agent Objects, used to start the agent.
|
|
687
687
|
- callback: The callback function.
|
|
688
688
|
|
|
689
|
+
##### iotagentLib.request()
|
|
690
|
+
|
|
691
|
+
###### Signature
|
|
692
|
+
|
|
693
|
+
```javascript
|
|
694
|
+
function request(options, callback)
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
###### Description
|
|
698
|
+
|
|
699
|
+
Make a direct HTTP request using the underlying request library (currently [got](https://github.com/sindresorhus/got)),
|
|
700
|
+
this is useful when creating agents which use an HTTP transport for their southbound commands, and removes the need for
|
|
701
|
+
the custom IoT Agent to import its own additional request library
|
|
702
|
+
|
|
703
|
+
###### Params
|
|
704
|
+
|
|
705
|
+
- options: definition of the request (see
|
|
706
|
+
[got options](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) for more details). The
|
|
707
|
+
following attributes are currently exposed.
|
|
708
|
+
- `method` - HTTP Method
|
|
709
|
+
- `searchParams` - query string params
|
|
710
|
+
- `qs` - alias for query string params
|
|
711
|
+
- `headers`
|
|
712
|
+
- `responseType` - either `text` or `json`. `json` is the default
|
|
713
|
+
- `json` - a supplied JSON object as the request body
|
|
714
|
+
- `body` - any ASCII text as the request body. It takes precedence over `json` if both are provided at the same
|
|
715
|
+
time (not recommended).
|
|
716
|
+
- `url` - the request URL
|
|
717
|
+
- `uri` - alternative alias for the request URL.
|
|
718
|
+
- callback: The callback currently returns an `error` Object, the `response` and `body`. The `body` is parsed to a
|
|
719
|
+
JSON object if the `responseType` is JSON.
|
|
720
|
+
|
|
689
721
|
#### Generic middlewares
|
|
690
722
|
|
|
691
723
|
This collection of utility middlewares is aimed to be used to north of the IoT Agent Library, as well as in other
|
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
ARG IMAGE_TAG=11.2-slim
|
|
2
|
+
FROM debian:${IMAGE_TAG}
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
ARG CLEAN_DEV_TOOLS
|
|
5
|
+
ENV CLEAN_DEV_TOOLS ${CLEAN_DEV_TOOLS:-1}
|
|
5
6
|
|
|
6
7
|
ENV CONGIF_FROM_ENV true
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
COPY aclfile /root/
|
|
10
|
+
COPY startMosquitto.sh /bin
|
|
11
|
+
|
|
12
|
+
RUN \
|
|
13
|
+
# Install security updates
|
|
14
|
+
apt-get -y update && \
|
|
15
|
+
apt-get -y upgrade && \
|
|
16
|
+
# Install dependencies
|
|
17
|
+
apt-get -y install \
|
|
18
|
+
wget \
|
|
19
|
+
mosquitto && \
|
|
20
|
+
cp /etc/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf.orig && \
|
|
21
|
+
chmod 755 /bin/startMosquitto.sh && \
|
|
22
|
+
mkdir -p /var/log/mosquitto && \
|
|
23
|
+
chown mosquitto:mosquitto /var/log/mosquitto && \
|
|
24
|
+
mkdir -p /var/run/mosquitto/ && \
|
|
25
|
+
chown mosquitto:mosquitto /var/run/mosquitto && \
|
|
26
|
+
echo "INFO: Cleaning unused software..." && \
|
|
27
|
+
apt-get clean && \
|
|
28
|
+
apt-get -y autoremove --purge && \
|
|
29
|
+
if [ ${CLEAN_DEV_TOOLS} -eq 0 ] ; then exit 0 ; fi && \
|
|
30
|
+
# remove the same packages we installed at the beginning to build Orch
|
|
31
|
+
apt-get -y autoremove --purge \
|
|
32
|
+
wget
|
|
16
33
|
|
|
17
34
|
|
|
18
35
|
EXPOSE 1883
|
|
@@ -2,9 +2,11 @@ Thi directory containts the Dockerfile (and associated files) for a container of
|
|
|
2
2
|
This container is provide as a help for users to test with MQTT, but it is just an auxiliary material in this repository.
|
|
3
3
|
|
|
4
4
|
The following releases matches with eclipse-mosquitto version:
|
|
5
|
-
-
|
|
6
|
-
- 1.
|
|
7
|
-
- 1.
|
|
8
|
-
- 1.
|
|
9
|
-
- 1.
|
|
10
|
-
- 1.
|
|
5
|
+
- 2.0.0 uses mosquitto-2.0.11 from Debian 11
|
|
6
|
+
- 1.6.0 uses mosquitto-1.6.10-1.el7.x86_64 (from Centos7)
|
|
7
|
+
- 1.5.0 uses mosquitto-1.6.10-1.el7.x86_64 (from Centos7)
|
|
8
|
+
- 1.4.0 uses mosquitto-1.6.10-1.el7.x86_64 (from Centos7)
|
|
9
|
+
- 1.3.0 uses mosquitto-1.6.8-1.el7.x86_64 (from Centos7)
|
|
10
|
+
- 1.2.0 uses mosquitto-1.6.7-1.el7.x86_64 (from Centos7)
|
|
11
|
+
- 1.1.0 uses mosquitto-1.5.8-1.el7.x86_64 (from Centos7)
|
|
12
|
+
- 1.0.0 uses mosquitto-1.4.8-1.el7.x86_64 (from Centos7)
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
echo "INFO: startMosquitto..."
|
|
4
|
+
|
|
5
|
+
if [ "${CONGIF_FROM_ENV}" = true ] ; then
|
|
6
|
+
cp /etc/mosquitto/mosquitto.conf.orig /etc/mosquitto/mosquitto.conf
|
|
7
|
+
sed -i 's/log_dest file \/var\/log\/mosquitto\/mosquitto.log/log_dest stderr/g' /etc/mosquitto/mosquitto.conf
|
|
4
8
|
echo "log_timestamp true" >> /etc/mosquitto/mosquitto.conf
|
|
5
9
|
echo "log_timestamp_format %Y-%m-%dT%H:%M:%S" >> /etc/mosquitto/mosquitto.conf
|
|
6
10
|
echo 'listener 9001' >> /etc/mosquitto/mosquitto.conf
|
|
7
11
|
echo 'protocol websockets' >> /etc/mosquitto/mosquitto.conf
|
|
8
12
|
echo 'listener 1883' >> /etc/mosquitto/mosquitto.conf
|
|
9
|
-
echo 'protocol mqtt' >> /etc/mosquitto/mosquitto.conf
|
|
13
|
+
echo 'protocol mqtt' >> /etc/mosquitto/mosquitto.conf
|
|
10
14
|
if ! [ -z "${IOTA_PASS}" ] ; then
|
|
11
15
|
# Only if IOTA_PASS is set and not empty MQTT user/pass authentication is used
|
|
12
16
|
touch /etc/mosquitto/pwfile
|
|
13
17
|
sed -i '$ i acl_file /etc/mosquitto/aclfile\npassword_file /etc/mosquitto/pwfile' /etc/mosquitto/mosquitto.conf
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
cp -f /root/aclfile /etc/mosquitto/aclfile
|
|
19
|
+
sed -i 's/user iota/user '${IOTA_USER}'/g' /etc/mosquitto/aclfile
|
|
20
|
+
mosquitto_passwd -b /etc/mosquitto/pwfile ${IOTA_USER} ${IOTA_PASS}
|
|
16
21
|
fi
|
|
17
22
|
fi
|
|
18
23
|
|
|
24
|
+
echo "INFO: content /etc/mosquitto/mosquitto.conf: "
|
|
25
|
+
cat /etc/mosquitto/mosquitto.conf
|
|
26
|
+
|
|
27
|
+
echo "INFO: start: startMosquitto -c /etc/mosquitto/mosquitto.conf"
|
|
28
|
+
|
|
19
29
|
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
|