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.
Files changed (141) hide show
  1. package/.github/workflows/ci.yml +1 -2
  2. package/.nyc_output/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
  3. package/.nyc_output/processinfo/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
  4. package/.nyc_output/processinfo/index.json +1 -0
  5. package/.readthedocs.yml +3 -1
  6. package/CHANGES_NEXT_RELEASE +1 -0
  7. package/README.md +5 -56
  8. package/doc/advanced-topics.md +121 -85
  9. package/doc/api.md +63 -54
  10. package/doc/development.md +8 -9
  11. package/doc/expressionLanguage.md +517 -316
  12. package/doc/installationguide.md +66 -64
  13. package/doc/northboundinteractions.md +40 -33
  14. package/doc/requirements.txt +4 -0
  15. package/{docs → doc}/roadmap.md +21 -6
  16. package/doc/usermanual.md +50 -18
  17. package/docker/Mosquitto/Dockerfile +28 -11
  18. package/docker/Mosquitto/README.md +8 -6
  19. package/docker/Mosquitto/startMosquitto.sh +14 -4
  20. package/lib/fiware-iotagent-lib.js +4 -2
  21. package/lib/jexlTranformsMap.js +11 -1
  22. package/lib/model/Device.js +4 -1
  23. package/lib/model/Group.js +19 -1
  24. package/lib/plugins/expressionParser.js +6 -4
  25. package/lib/plugins/expressionPlugin.js +63 -22
  26. package/lib/plugins/jexlParser.js +3 -1
  27. package/lib/plugins/multiEntity.js +2 -21
  28. package/lib/request-shim.js +111 -0
  29. package/lib/services/common/domain.js +6 -2
  30. package/lib/services/common/genericMiddleware.js +6 -2
  31. package/lib/services/common/iotManagerService.js +1 -1
  32. package/lib/services/common/securityServiceKeystone.js +1 -1
  33. package/lib/services/common/securityServiceOAuth2.js +3 -2
  34. package/lib/services/devices/deviceRegistryMemory.js +13 -2
  35. package/lib/services/devices/deviceRegistryMongoDB.js +16 -7
  36. package/lib/services/devices/deviceService.js +26 -2
  37. package/lib/services/devices/devices-NGSI-LD.js +1 -1
  38. package/lib/services/devices/devices-NGSI-v2.js +2 -6
  39. package/lib/services/devices/registrationUtils.js +0 -2
  40. package/lib/services/ngsi/entities-NGSI-LD.js +97 -11
  41. package/lib/services/ngsi/entities-NGSI-v2.js +95 -8
  42. package/lib/services/ngsi/ngsiService.js +5 -4
  43. package/lib/services/northBound/contextServer-NGSI-LD.js +3 -2
  44. package/lib/services/northBound/contextServer-NGSI-v2.js +32 -27
  45. package/lib/services/northBound/contextServerUtils.js +1 -1
  46. package/lib/services/northBound/deviceProvisioningServer.js +31 -6
  47. package/lib/services/northBound/northboundServer.js +2 -0
  48. package/lib/services/northBound/restUtils.js +1 -1
  49. package/lib/templates/createDevice.json +12 -0
  50. package/lib/templates/updateDevice.json +12 -0
  51. package/package.json +9 -15
  52. package/test/tools/utils.js +2 -0
  53. package/test/unit/expressions/jexlExpression-test.js +5 -5
  54. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +1 -1
  55. package/test/unit/general/deviceService-test.js +2 -5
  56. package/test/unit/general/loglevel-api_test.js +6 -11
  57. package/test/unit/general/startup-test.js +1 -0
  58. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +1 -0
  59. package/test/unit/mongodb/mongodb-group-registry-test.js +1 -1
  60. package/test/unit/mongodb/mongodb-registry-test.js +2 -1
  61. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin12a.json +7 -0
  62. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin13.json +13 -13
  63. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +18 -0
  64. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +18 -0
  65. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin31.json +15 -0
  66. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +17 -0
  67. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin33.json +18 -0
  68. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin34.json +17 -0
  69. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4a.json +36 -0
  70. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin7.json +16 -16
  71. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin8a.json +18 -0
  72. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
  73. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1018 -0
  74. package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +2 -2
  75. package/test/unit/ngsi-ld/general/deviceService-test.js +1 -1
  76. package/test/unit/ngsi-ld/general/https-support-test.js +2 -1
  77. package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +2 -1
  78. package/test/unit/ngsi-ld/general/startup-test.js +1 -0
  79. package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
  80. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +2 -1
  81. package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +2 -6
  82. package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +2 -1
  83. package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +1 -0
  84. package/test/unit/ngsi-ld/ngsiService/autocast-test.js +1 -0
  85. package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +1 -0
  86. package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +4 -3
  87. package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +1 -0
  88. package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +3 -2
  89. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +61 -0
  90. package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +2 -1
  91. package/test/unit/ngsi-ld/provisioning/device-registration_test.js +3 -2
  92. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +1 -0
  93. package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +42 -54
  94. package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +2 -1
  95. package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +4 -4
  96. package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +3 -5
  97. package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +12 -18
  98. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +3 -1
  99. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin17.json +1 -1
  100. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +16 -0
  101. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +22 -0
  102. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +12 -0
  103. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +2 -0
  104. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
  105. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
  106. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +25 -0
  107. package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +4 -4
  108. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +561 -0
  109. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +3 -2
  110. package/test/unit/ngsiv2/general/deviceService-test.js +9 -8
  111. package/test/unit/ngsiv2/general/https-support-test.js +2 -1
  112. package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +2 -1
  113. package/test/unit/ngsiv2/general/startup-test.js +1 -0
  114. package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
  115. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +2 -1
  116. package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +14 -18
  117. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +3 -1
  118. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +1 -0
  119. package/test/unit/ngsiv2/ngsiService/queryDeviceInformationInCb-test.js +0 -1
  120. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +4 -3
  121. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +3 -2
  122. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +210 -0
  123. package/test/unit/ngsiv2/plugins/translation-inPlugins_test.js +1 -1
  124. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +3 -2
  125. package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +2 -1
  126. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +2 -1
  127. package/test/unit/ngsiv2/provisioning/device-registration_test.js +3 -2
  128. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +4 -3
  129. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +42 -53
  130. package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +2 -1
  131. package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +4 -4
  132. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +3 -4
  133. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +13 -19
  134. package/test/unit/plugins/capture-configuration-inPlugins_test.js +3 -1
  135. package/test/unit/plugins/capture-provision-inPlugins_test.js +2 -1
  136. package/bin/agentConsole.js +0 -257
  137. package/bin/iotAgentTester.js +0 -44
  138. package/lib/command/commandLine.js +0 -918
  139. package/lib/command/migration.js +0 -176
  140. package/test/unit/general/migration-test.js +0 -256
  141. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin20.json +0 -25
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":26617,"argv":["/home/fermin/.nvm/versions/node/v10.24.1/bin/node","/home/fermin/src/iotagent-node-lib/node_modules/.bin/mocha","--recursive","test/**/*.js","--reporter","spec","--timeout","8000","--ui","bdd","--exit","--color","true"],"execArgv":[],"cwd":"/home/fermin/src/iotagent-node-lib","time":1646066946112,"ppid":26606,"coverageFilename":"/home/fermin/src/iotagent-node-lib/.nyc_output/76bc24ff-5fac-4b5a-997d-de2799342eb0.json","externalId":"","uuid":"76bc24ff-5fac-4b5a-997d-de2799342eb0","files":["/home/fermin/src/iotagent-node-lib/lib/fiware-iotagent-lib.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/ngsiService.js","/home/fermin/src/iotagent-node-lib/lib/services/common/domain.js","/home/fermin/src/iotagent-node-lib/lib/constants.js","/home/fermin/src/iotagent-node-lib/lib/errors.js","/home/fermin/src/iotagent-node-lib/lib/commonConfig.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/ngsiUtils.js","/home/fermin/src/iotagent-node-lib/lib/services/common/genericMiddleware.js","/home/fermin/src/iotagent-node-lib/lib/model/dbConn.js","/home/fermin/src/iotagent-node-lib/lib/services/common/alarmManagement.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscriptionService.js","/home/fermin/src/iotagent-node-lib/lib/services/stats/statsRegistry.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceService.js","/home/fermin/src/iotagent-node-lib/lib/services/groups/groupService.js","/home/fermin/src/iotagent-node-lib/lib/services/common/iotManagerService.js","/home/fermin/src/iotagent-node-lib/lib/request-shim.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/registrationUtils.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/restUtils.js","/home/fermin/src/iotagent-node-lib/lib/services/commands/commandService.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/northboundServer.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServerUtils.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/deviceProvisioningServer.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/deviceGroupAdministrationServer.js","/home/fermin/src/iotagent-node-lib/lib/plugins/compressTimestamp.js","/home/fermin/src/iotagent-node-lib/lib/plugins/pluginUtils.js","/home/fermin/src/iotagent-node-lib/lib/plugins/attributeAlias.js","/home/fermin/src/iotagent-node-lib/lib/plugins/addEvent.js","/home/fermin/src/iotagent-node-lib/lib/plugins/timestampProcessPlugin.js","/home/fermin/src/iotagent-node-lib/lib/plugins/expressionPlugin.js","/home/fermin/src/iotagent-node-lib/lib/plugins/expressionParser.js","/home/fermin/src/iotagent-node-lib/lib/plugins/jexlParser.js","/home/fermin/src/iotagent-node-lib/lib/jexlTranformsMap.js","/home/fermin/src/iotagent-node-lib/lib/plugins/multiEntity.js","/home/fermin/src/iotagent-node-lib/lib/plugins/bidirectionalData.js","/home/fermin/src/iotagent-node-lib/lib/services/groups/groupRegistryMemory.js","/home/fermin/src/iotagent-node-lib/lib/services/common/securityServiceKeystone.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceRegistryMemory.js","/home/fermin/src/iotagent-node-lib/lib/services/commands/commandRegistryMemory.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-v2.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-v2.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-v2.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-v2.js","/home/fermin/src/iotagent-node-lib/lib/model/Device.js","/home/fermin/src/iotagent-node-lib/lib/model/Group.js","/home/fermin/src/iotagent-node-lib/lib/model/Command.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceRegistryMongoDB.js","/home/fermin/src/iotagent-node-lib/lib/services/groups/groupRegistryMongoDB.js","/home/fermin/src/iotagent-node-lib/lib/services/commands/commandRegistryMongoDB.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-LD.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-LD.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-LD.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-LD.js","/home/fermin/src/iotagent-node-lib/lib/services/common/securityServiceOAuth2.js","/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-mixed.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-mixed.js","/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-mixed.js","/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-mixed.js"]}
@@ -0,0 +1 @@
1
+ {"processes":{"76bc24ff-5fac-4b5a-997d-de2799342eb0":{"parent":null,"children":[]}},"files":{"/home/fermin/src/iotagent-node-lib/lib/fiware-iotagent-lib.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/ngsiService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/domain.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/constants.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/errors.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/commonConfig.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/ngsiUtils.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/genericMiddleware.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/model/dbConn.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/alarmManagement.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscriptionService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/stats/statsRegistry.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/groups/groupService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/iotManagerService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/request-shim.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/registrationUtils.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/restUtils.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/commands/commandService.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/northboundServer.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServerUtils.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/deviceProvisioningServer.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/deviceGroupAdministrationServer.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/compressTimestamp.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/pluginUtils.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/attributeAlias.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/addEvent.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/timestampProcessPlugin.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/expressionPlugin.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/expressionParser.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/jexlParser.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/jexlTranformsMap.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/multiEntity.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/plugins/bidirectionalData.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/groups/groupRegistryMemory.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/securityServiceKeystone.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceRegistryMemory.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/commands/commandRegistryMemory.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-v2.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-v2.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-v2.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-v2.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/model/Device.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/model/Group.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/model/Command.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/deviceRegistryMongoDB.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/groups/groupRegistryMongoDB.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/commands/commandRegistryMongoDB.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-LD.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-LD.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-LD.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-LD.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/common/securityServiceOAuth2.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/devices/devices-NGSI-mixed.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/subscription-NGSI-mixed.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/northBound/contextServer-NGSI-mixed.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"],"/home/fermin/src/iotagent-node-lib/lib/services/ngsi/entities-NGSI-mixed.js":["76bc24ff-5fac-4b5a-997d-de2799342eb0"]},"externalIds":{}}
package/.readthedocs.yml CHANGED
@@ -4,4 +4,6 @@ mkdocs:
4
4
  configuration: mkdocs.yml
5
5
 
6
6
  python:
7
- version: 3.6
7
+ version: 3.8
8
+ install:
9
+ - requirements: doc/requirements.txt
@@ -0,0 +1 @@
1
+
package/README.md CHANGED
@@ -20,7 +20,7 @@ platform (authentication and authorization of the channel) and provide other com
20
20
  This project is part of [FIWARE](https://www.fiware.org/). For more information check the FIWARE Catalogue entry for the
21
21
  [IoT Agents](https://github.com/Fiware/catalogue/tree/master/iot-agents).
22
22
 
23
- | :books: [Documentation](https://iotagent-node-lib.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/iot-agents/idas) | :dart: [Roadmap](https://github.com/telefonicaid/iotagent-node-lib/blob/master/docs/roadmap.md) |
23
+ | :books: [Documentation](https://iotagent-node-lib.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/iot-agents/idas) | :dart: [Roadmap](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/roadmap.md) |
24
24
  | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
25
25
 
26
26
 
@@ -72,7 +72,7 @@ IoT Agent
72
72
  In order to use the library within your own IoT Agent, you must first you require it before use:
73
73
 
74
74
  ```javascript
75
- const iotagentLib = require("iotagent-node-lib");
75
+ const iotagentLib = require('iotagent-node-lib');
76
76
  ```
77
77
 
78
78
  Information about how to configure the Library can be found at the corresponding section of the
@@ -298,64 +298,13 @@ configuration is independent, and can be checked with the `showConfigCb` and `sh
298
298
  Their values can be changed with the `configCb` and `configIot` commands respectively. The new configurations will be
299
299
  deleted upon startup.
300
300
 
301
- #### Creating specialized testers
302
-
303
- The command-line testing tools make use of the
304
- [command-node Node.js library](https://github.com/telefonicaid/command-shell-lib) for command-line utils. In order to
305
- help creating testing tools for IoTAgents of specific protocols, all the commands of the library tester are offered as a
306
- array that can be directly imported into other Command-Line tools, using the following steps:
307
-
308
- - Require the `iotagent-node-lib` command-line module in your command-line tool:
309
-
310
- ```javascript
311
- var iotaCommands = require("iotagent-node-lib").commandLine;
312
- ```
313
-
314
- - Initialize the command-line utils (the initialization function takes two arguments, that will be explained in detail
315
- below:
316
-
317
- ```javascript
318
- iotaCommands.init(configCb, configIot);
319
- ```
320
-
321
- - Add the IOTA Lib commands to your array of commands
322
-
323
- ```javascript
324
- commands = commands.concat(commands, iotaCommands.commands);
325
- ```
326
-
327
- - Execute the command-line interpreter as usual:
328
-
329
- ```javascript
330
- clUtils.initialize(commandLine.commands, "IoT Agent tester> ");
331
- ```
332
-
333
- The command-line module makes use of two configuration objects. Both can be shown and edited in the command-line using
334
- the provided commands, but a default value must be present.
335
-
336
- The Context Broker configuration object holds all the information about the Context Broker where the IoT Agent to be
337
- tested is connected. It MUST contain the following attributes:
338
-
339
- - **host**: host where the Context Broker instance is located.
340
- - **port**: port where the Context Broker instance is listening.
341
- - **service**: service that will be used in all the NGSI operations.
342
- - **subservice**: service that will be used in all the NGSI operations.
343
-
344
- The IoT Agent configuration object holds information about the IoT Agent that is being tested. It MUST contain the
345
- following attributes:
346
-
347
- - **host**: host where the IoT Agent instance is located.
348
- - **port**: port where the IoT Agent instance is listening.
349
- - **service**: service that will be used to group devices and device information.
350
- - **subservice**: subservice that will be used to group devices and device information.
351
-
352
301
  ---
353
302
 
354
303
  ## Licence
355
304
 
356
305
  The IoT Agent Node Library is licensed under [Affero General Public License (GPL) version 3](./LICENSE).
357
306
 
358
- © 2019 Telefonica Investigación y Desarrollo, S.A.U
307
+ © 2022 Telefonica Investigación y Desarrollo, S.A.U
359
308
 
360
309
  ### Are there any legal issues with AGPL 3.0? Is it safe for me to use?
361
310
 
@@ -364,8 +313,8 @@ related with the fact that different people assign different interpretations on
364
313
  used in these licenses. Due to this, some people believe that there is a risk in just _using_ software under GPL or AGPL
365
314
  licenses (even without _modifying_ it).
366
315
 
367
- For the avoidance of doubt, the owners of this software licensed under an AGPL-3.0 license
368
- wish to make a clarifying public statement as follows:
316
+ For the avoidance of doubt, the owners of this software licensed under an AGPL-3.0 license wish to make a clarifying
317
+ public statement as follows:
369
318
 
370
319
  > Please note that software derived as a result of modifying the source code of this software in order to fix a bug or
371
320
  > incorporate enhancements is considered a derivative work of the product. Software that merely uses or aggregates (i.e.
@@ -1,37 +1,35 @@
1
1
  ## Advanced Topics
2
2
 
3
- * [Secured access to the Context Broker](#secured-access-to-the-context-broker)
4
- * [GeoJSON support NGSI-LD only](#geojson-support-ngsi-ld-only)
5
- * [Metadata support](#metadata-support)
6
- * [NGSI LD data and metadata considerations](#ngsi-ld-data-and-metadata-considerations)
7
- * [NGSI-LD Linked Data support](#ngsi-ld-linked-data-support)
8
- * [Autoprovision configuration (autoprovision)](#autoprovision-configuration-autoprovision)
9
- * [Explicitly defined attributes (explicitAttrs)](#explicitly-defined-attributes-explicitattrs)
10
- * [Configuring operation to persist the data in Context Broker (appendMode)](#configuring-operation-to-persist-the-data-in-context-broker-appendmode)
11
- * [Data mapping plugins](#data-mapping-plugins)
12
- * [Development](#development)
13
- * [Provided plugins](#provided-plugins)
14
- * [Timestamp Compression plugin (compressTimestamp)](#timestamp-compression-plugin-compresstimestamp)
15
- * [Attribute Alias plugin (attributeAlias)](#attribute-alias-plugin-attributealias)
16
- * [Event plugin (addEvents)](#event-plugin-addevents)
17
- * [Timestamp Processing Plugin (timestampProcess)](#timestamp-processing-plugin-timestampprocess)
18
- * [Expression Translation plugin (expressionTransformation)](#expression-translation-plugin-expressiontransformation)
19
- * [Multientity plugin (multiEntity)](#multientity-plugin-multientity)
20
- * [Bidirectionality plugin (bidirectional)](#bidirectionality-plugin-bidirectional)
21
- * [Autoprovision configuration (autoprovision)](#autoprovision-configuration-autoprovision)
22
- * [Explicitly defined attributes (explicitAttrs)](#explicitly-defined-attributes-explicitattrs)
23
- * [Configuring operation to persist the data in Context Broker (appendMode)](#configuring-operation-to-persist-the-data-in-context-broker-appendmode)
24
- * [Old IoTAgent data migration](#old-iotagent-data-migration)
25
-
3
+ - [Secured access to the Context Broker](#secured-access-to-the-context-broker)
4
+ - [NGSI-LD `GeoProperty` support](#ngsi-ld-geoproperty-support)
5
+ - [Metadata support](#metadata-support)
6
+ - [NGSI LD data and metadata considerations](#ngsi-ld-data-and-metadata-considerations)
7
+ - [NGSI-LD Linked Data support](#ngsi-ld-linked-data-support)
8
+ - [Autoprovision configuration (autoprovision)](#autoprovision-configuration-autoprovision)
9
+ - [Explicitly defined attributes (explicitAttrs)](#explicitly-defined-attributes-explicitattrs)
10
+ - [Configuring operation to persist the data in Context Broker (appendMode)](#configuring-operation-to-persist-the-data-in-context-broker-appendmode)
11
+ - [Data mapping plugins](#data-mapping-plugins)
12
+ - [Development](#development)
13
+ - [Provided plugins](#provided-plugins)
14
+ - [Timestamp Compression plugin (compressTimestamp)](#timestamp-compression-plugin-compresstimestamp)
15
+ - [Attribute Alias plugin (attributeAlias)](#attribute-alias-plugin-attributealias)
16
+ - [Event plugin (addEvents)](#event-plugin-addevents)
17
+ - [Timestamp Processing Plugin (timestampProcess)](#timestamp-processing-plugin-timestampprocess)
18
+ - [Expression Translation plugin (expressionTransformation)](#expression-translation-plugin-expressiontransformation)
19
+ - [Multientity plugin (multiEntity)](#multientity-plugin-multientity)
20
+ - [Bidirectionality plugin (bidirectional)](#bidirectionality-plugin-bidirectional)
21
+ - [Autoprovision configuration (autoprovision)](#autoprovision-configuration-autoprovision)
22
+ - [Explicitly defined attributes (explicitAttrs)](#explicitly-defined-attributes-explicitattrs)
23
+ - [Configuring operation to persist the data in Context Broker (appendMode)](#configuring-operation-to-persist-the-data-in-context-broker-appendmode)
26
24
 
27
25
  ### Secured access to the Context Broker
28
26
 
29
27
  For access to instances of the Context Broker secured with a
30
28
  [PEP Proxy](https://github.com/telefonicaid/fiware-orion-pep), an authentication mechanism based in Keystone Trust
31
- tokens is provided. A trust token is a way of Keystone to allow an user delegates a role to another user for a subservice.
32
- It is a long-term token that can be issued by any user to give another user permissions
33
- to impersonate him with a given role in a given project (subservice). Such impersonation itself is in turn based on a short-term
34
- access token.
29
+ tokens is provided. A trust token is a way of Keystone to allow an user delegates a role to another user for a
30
+ subservice. It is a long-term token that can be issued by any user to give another user permissions to impersonate him
31
+ with a given role in a given project (subservice). Such impersonation itself is in turn based on a short-term access
32
+ token.
35
33
 
36
34
  For the authentication mechanisms to work, the `authentication` attribute in the configuration has to be fully
37
35
  configured, and the `authentication.enabled` subattribute should have the value `true`.
@@ -73,15 +71,18 @@ Agent.
73
71
 
74
72
  Complete info on Keystone trust tokens could be found at:
75
73
 
76
- - [Trusts concept](https://docs.openstack.org/keystone/stein/user/trusts)
77
- - [Trusts API](https://docs.openstack.org/keystone/stein/api_curl_examples.html#post-v3-os-trust-trusts)
74
+ - [Trusts concept](https://docs.openstack.org/keystone/stein/user/trusts)
75
+ - [Trusts API](https://docs.openstack.org/keystone/stein/api_curl_examples.html#post-v3-os-trust-trusts)
76
+
77
+ ### NGSI-LD `GeoProperty` support
78
78
 
79
- ### GeoJSON support NGSI-LD only
79
+ For NGSI-LD only, the defined `type` of any GeoJSON attribute can be any set using any of the standard NGSI-v2 GeoJSON
80
+ types - (e.g. `geo:json`, `geo:point`). NGSI-LD formats such as `GeoProperty`, `Point` and `LineString` are also
81
+ accepted `type` values. If the latitude and longitude are received as separate measures, the JEXL or legacy
82
+ [expression language](expressionLanguage.md) can be used to concatenate them into GeoJSON objects an array of tuples or
83
+ a string as shown
80
84
 
81
- The defined `type` of any GeoJSON attribute can be any set to any of the standard NGSI-v2 GeoJSON types - (e.g.
82
- `geo:json`, `geo:point`). NGSI-LD formats such as `GeoProperty`, `Point` and `LineString` are also accepted `type`
83
- values. If the latitude and longitude are received as separate measures, the
84
- [expression language](expressionLanguage.md) can be used to concatenate them.
85
+ #### Legacy - encode as String
85
86
 
86
87
  ```json
87
88
  {
@@ -99,8 +100,30 @@ values. If the latitude and longitude are received as separate measures, the
99
100
  }
100
101
  ```
101
102
 
102
- For `attributes` and `static_attributes` which need to be formatted as GeoJSON values, three separate input formats are
103
- accepted. Provided the `type` is provisioned correctly, the `value` may be defined using any of the following formats:
103
+ #### JEXL - encode as GeoJSON
104
+
105
+ ```json
106
+ {
107
+ "entity_type": "GPS",
108
+ "resource": "/iot/d",
109
+ "protocol": "PDI-IoTA-JSON",
110
+ "expressionLanguage": "jexl",
111
+ ..etc
112
+ "attributes": [
113
+ {
114
+ "name": "location",
115
+ "type": "geo:json",
116
+ "expression": "{coordinates: [longitude,latitude], type: 'Point'}"
117
+ }
118
+ ]
119
+ }
120
+ ```
121
+
122
+ JEXL can be used to create GeoJSON objects directly. The Legacy expression language does not support GeoJSON. However,
123
+ there is a workaround specifically for NGSI-LD Entities which always require `location` to be encoded as GeoJSON. For
124
+ `attributes` and `static_attributes` which need to be formatted as GeoJSON values, three separate input formats are
125
+ currently accepted. Provided the `type` is provisioned correctly, the `value` may be defined using any of the following
126
+ formats:
104
127
 
105
128
  - a comma delimited string
106
129
 
@@ -269,26 +292,70 @@ updated as shown:
269
292
 
270
293
  ### Autoprovision configuration (autoprovision)
271
294
 
272
- By default, when a measure arrives to the IoTAgent, if the `device_id` does not match with an existing one, then, the IoTA
273
- creates a new device and a new entity according to the group config. Defining the field `autoprovision` to `false`
274
- when provisioning the device group, the IoTA to reject the measure at the southbound, allowing only to persist the
275
- data to devices that are already provisioned. It makes no sense to use this field in device provisioning since it is
276
- intended to avoid provisioning devices (and for it to be effective, it would have to be provisional).
295
+ By default, when a measure arrives to the IoTAgent, if the `device_id` does not match with an existing one, then, the
296
+ IoTA creates a new device and a new entity according to the group config. Defining the field `autoprovision` to `false`
297
+ when provisioning the device group, the IoTA to reject the measure at the southbound, allowing only to persist the data
298
+ to devices that are already provisioned. It makes no sense to use this field in device provisioning since it is intended
299
+ to avoid provisioning devices (and for it to be effective, it would have to be provisional).
277
300
 
278
301
  ### Explicitly defined attributes (explicitAttrs)
279
302
 
280
- If a given measure element (object_id) is not defined in the mappings of the device or group provision, the measure is stored
281
- in the Context Broker by adding a new attribute to the entity with the same name of the undefined measure element. By adding the
282
- field `explicitAttrs` with `true` value to device or group provision, the IoTAgent rejects the measure elements that are not defined
283
- in the mappings of device or group provision, persisting only the one defined in the mappings of the provision. If `explicitAttrs`
284
- is provided both at device and group level, the device level takes precedence.
303
+ If a given measure element (object_id) is not defined in the mappings of the device or group provision, the measure is
304
+ stored in the Context Broker by adding a new attribute to the entity with the same name of the undefined measure
305
+ element. By adding the field `explicitAttrs` with `true` value to device or group provision, the IoTAgent rejects the
306
+ measure elements that are not defined in the mappings of device or group provision, persisting only the one defined in
307
+ the mappings of the provision. If `explicitAttrs` is provided both at device and group level, the device level takes
308
+ precedence. Additionally `explicitAttrs` can be used to define which meassures (identified by their attribute names, not
309
+ by their object_id) defined in JSON/JEXL array will be propagated to NGSI interface.
310
+
311
+ The different possibilities are summarized below:
312
+
313
+ Case 1 (default):
314
+
315
+ ```
316
+ "explicitAttrs": false
317
+ ```
318
+
319
+ every measure will be propagated to NGSI interface.
320
+
321
+ Case 2:
322
+
323
+ ```
324
+ "explicitAttrs": true
325
+ ```
326
+
327
+ just measures defined in active, static (plus conditionally TimeInstant) will be propagated to NGSI interface.
328
+
329
+ Case 3:
330
+
331
+ ```
332
+ "explicitAttrs": "['attr1','atrr2']"
333
+ ```
334
+
335
+ just measures defined in the array (identified by their attribute names, not by their object_id) will be will be
336
+ propagated to NGSI interface (note that in this case the value of `explicitAttrs` is not a JSON but a string that looks likes a JSON).
337
+
338
+ Case 4:
339
+
340
+ ```
341
+ "explicitAtttr": "<JEXL expression resulting in bool or array>"
342
+ ```
343
+
344
+ depending on the JEXL expression evaluation:
345
+
346
+ - If it evaluates to `true` every measure will be propagated to NGSI interface (as in case 1)
347
+ - If it evaluates to `false` just measures defined in active, static (plus conditionally TimeInstant) will be
348
+ propagated to NGSI interface (as in case 2)
349
+ - If it evaluates to an array just measures defined in the array (identified by their attribute names, not by their object_id)
350
+ will be will be propagated to NGSI interface (as in case 3)
285
351
 
286
352
  ### Configuring operation to persist the data in Context Broker (appendMode)
287
353
 
288
- This is a flag that can be enabled by activating the parameter `appendMode` in the configuration file or by using the `IOTA_APPEND_MODE`
289
- environment variable (more info [here](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md)).
290
- If this flag is activated, the update requests to the Context Broker will be performed always with APPEND type, instead of the
291
- default UPDATE. This have implications in the use of attributes with Context Providers, so this flag should be used with care.
354
+ This is a flag that can be enabled by activating the parameter `appendMode` in the configuration file or by using the
355
+ `IOTA_APPEND_MODE` environment variable (more info
356
+ [here](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md)). If this flag is
357
+ activated, the update requests to the Context Broker will be performed always with APPEND type, instead of the default
358
+ UPDATE. This have implications in the use of attributes with Context Providers, so this flag should be used with care.
292
359
 
293
360
  ### Data mapping plugins
294
361
 
@@ -373,8 +440,8 @@ events in the IoT Agent with the configured type name will be marked as events.
373
440
 
374
441
  ##### Timestamp Processing Plugin (timestampProcess)
375
442
 
376
- This plugin processes the entity attributes looking for a `TimeInstant` attribute. If one is found, for NGSIv2,
377
- the plugin adds a `TimeInstant` attribute as metadata for every other attribute in the same request. With NGSI-LD, the
443
+ This plugin processes the entity attributes looking for a `TimeInstant` attribute. If one is found, for NGSIv2, the
444
+ plugin adds a `TimeInstant` attribute as metadata for every other attribute in the same request. With NGSI-LD, the
378
445
  Standard `observedAt` property-of-a-property is used instead.
379
446
 
380
447
  ##### Expression Translation plugin (expressionTransformation)
@@ -438,7 +505,8 @@ When a device is provisioned with bidirectional attributes, the IoTAgent subscri
438
505
  change notification for that attribute arrives to the IoTA, it applies the transformation defined in the device
439
506
  provisioning payload to the notification, and calls the underlying notification handler with the transformed entity.
440
507
 
441
- The following `attributes` section shows an example of the plugin configuration (using IOTA_AUTOCAST=false to avoid translation from geo:point to geo:json)
508
+ The following `attributes` section shows an example of the plugin configuration (using IOTA_AUTOCAST=false to avoid
509
+ translation from geo:point to geo:json)
442
510
 
443
511
  ```json
444
512
  "attributes": [
@@ -470,35 +538,3 @@ subscription payload.
470
538
  For each attribute in the `reverse` array, an expression must be defined to calculate its value based on the
471
539
  notification attributes. This value will be passed to the underlying protocol with the `object_id` name. Details about
472
540
  how the value is then progressed to the device are protocol-specific.
473
-
474
- ### Old IoTAgent data migration
475
-
476
- In order to ease the transition from the old IoTAgent implementation (formerly known as IDAS) to the new Node.js based
477
- implementations, a data migration tool has been developed. This data migration tool has been integrated as a command in
478
- the IoTAgent command-line tester.
479
-
480
- In order to perform a full migration, follow this steps:
481
-
482
- - From the project root, start the command-line tester:
483
-
484
- ```bash
485
- bin/iotAgentTester.js
486
- ```
487
-
488
- - Configure the MongoDB host and port, and the origin Database (that holds the data to be migrated):
489
-
490
- ```bash
491
- configMigration localhost 27017 originDB
492
- ```
493
-
494
- - Launch the migration, using the special value "\*" as service and subservice
495
-
496
- ```bash
497
- migrate targetDB * *
498
- ```
499
-
500
- Some warnings may appear with the "Attribute [_id] was not found for item translation" message during the migration.
501
- They show the values existing in the original DB that had no translation for the target DB.
502
-
503
- If you want to restrict the migration for certain services and subservices, just substitute the `*` value for the
504
- particular service and subservice you want to use.