iotagent-node-lib 3.4.4 → 4.0.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 (95) hide show
  1. package/README.md +4 -0
  2. package/doc/admin.md +1 -13
  3. package/doc/api.md +116 -18
  4. package/doc/devel/architecture.md +0 -12
  5. package/doc/index.md +1 -1
  6. package/doc/roadmap.md +22 -10
  7. package/lib/commonConfig.js +0 -11
  8. package/lib/errors.js +2 -2
  9. package/lib/model/Device.js +2 -1
  10. package/lib/model/Group.js +2 -1
  11. package/lib/model/dbConn.js +22 -11
  12. package/lib/plugins/expressionPlugin.js +0 -5
  13. package/lib/plugins/jexlParser.js +15 -31
  14. package/lib/services/common/genericMiddleware.js +14 -2
  15. package/lib/services/common/iotManagerService.js +2 -1
  16. package/lib/services/devices/deviceRegistryMongoDB.js +3 -1
  17. package/lib/services/devices/deviceService.js +16 -21
  18. package/lib/services/devices/devices-NGSI-LD.js +5 -98
  19. package/lib/services/devices/devices-NGSI-mixed.js +0 -14
  20. package/lib/services/devices/devices-NGSI-v2.js +3 -0
  21. package/lib/services/groups/groupRegistryMemory.js +0 -25
  22. package/lib/services/groups/groupRegistryMongoDB.js +20 -19
  23. package/lib/services/groups/groupService.js +3 -14
  24. package/lib/services/ngsi/entities-NGSI-LD.js +82 -7
  25. package/lib/services/ngsi/entities-NGSI-v2.js +297 -696
  26. package/lib/services/ngsi/ngsiUtils.js +0 -30
  27. package/lib/services/northBound/deviceProvisioningServer.js +6 -3
  28. package/lib/templates/createDevice.json +4 -0
  29. package/lib/templates/createDeviceLax.json +4 -0
  30. package/lib/templates/deviceGroup.json +4 -0
  31. package/lib/templates/updateDevice.json +4 -0
  32. package/lib/templates/updateDeviceLax.json +4 -0
  33. package/package.json +6 -2
  34. package/test/functional/README.md +378 -0
  35. package/test/functional/config-test.js +70 -0
  36. package/test/functional/functional-tests-runner.js +126 -0
  37. package/test/functional/functional-tests.js +241 -0
  38. package/test/functional/testCases.js +2944 -0
  39. package/test/functional/testUtils.js +251 -0
  40. package/test/tools/utils.js +25 -0
  41. package/test/unit/mongodb/mongodb-connectionoptions-test.js +35 -22
  42. package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic2.json +3 -34
  43. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin6.json +8 -1
  44. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin7.json +1 -4
  45. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin8.json +1 -6
  46. package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +67 -87
  47. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +7 -13
  48. package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +43 -43
  49. package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +19 -29
  50. package/test/unit/ngsi-ld/ngsiService/languageProperties-test.js +0 -1
  51. package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +35 -46
  52. package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +8 -9
  53. package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +96 -221
  54. package/test/unit/ngsi-ld/provisioning/device-registration_test.js +18 -27
  55. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +8 -16
  56. package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +0 -13
  57. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json +4 -4
  58. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29b.json +8 -0
  59. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +1 -1
  60. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +0 -6
  61. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +8 -0
  62. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34b.json +14 -0
  63. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +1 -11
  64. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36b.json +13 -0
  65. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin37.json +8 -0
  66. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +1 -11
  67. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10b.json +37 -0
  68. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +0 -4
  69. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +0 -4
  70. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +0 -4
  71. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +4 -0
  72. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json +0 -3
  73. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json +10 -12
  74. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json +0 -4
  75. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json +1 -5
  76. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json +8 -12
  77. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +0 -4
  78. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +0 -8
  79. package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json +7 -1
  80. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +898 -28
  81. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +0 -4
  82. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +267 -0
  83. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +19 -21
  84. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +21 -24
  85. package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +1 -21
  86. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +4 -6
  87. package/CHANGES_NEXT_RELEASE +0 -0
  88. package/test/unit/ngsi-ld/ngsiService/autocast-test.js +0 -438
  89. package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +0 -381
  90. package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +0 -311
  91. package/test/unit/ngsiv2/ngsiService/autocast-test.js +0 -325
  92. package/test/unit/ngsiv2/ngsiService/geoproperties-test.js +0 -427
  93. package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +0 -217
  94. package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +0 -119
  95. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -309
@@ -0,0 +1,13 @@
1
+ {
2
+ "id":"gps1","type":"GPS",
3
+ "mylocation": {
4
+ "type": "geo:json",
5
+ "value": {
6
+ "coordinates": [
7
+ 13,
8
+ 52
9
+ ],
10
+ "type": "Point"
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "id": "gps1",
3
+ "type": "GPS",
4
+ "color": {
5
+ "value": "blue",
6
+ "type": "string"
7
+ }
8
+ }
@@ -1,9 +1,5 @@
1
1
  {
2
2
  "id":"gps1","type":"GPS",
3
- "TimeInstant": {
4
- "type": "DateTime",
5
- "value": "2015-08-05T07:35:01.468+00:00"
6
- },
7
3
  "location": {
8
4
  "value": {
9
5
  "coordinates": [
@@ -12,12 +8,6 @@
12
8
  ],
13
9
  "type": "Point"
14
10
  },
15
- "type": "geo:json",
16
- "metadata": {
17
- "TimeInstant": {
18
- "type": "DateTime",
19
- "value": "2015-08-05T07:35:01.468+00:00"
20
- }
21
- }
11
+ "type": "geo:json"
22
12
  }
23
13
  }
@@ -0,0 +1,37 @@
1
+ {
2
+ "actionType": "append",
3
+ "entities": [
4
+ {
5
+ "id": "ws9",
6
+ "type": "WeatherStation",
7
+ "st1": {
8
+ "value": 1,
9
+ "type": "Number"
10
+ },
11
+ "st2": {
12
+ "value": 2,
13
+ "type": "Number"
14
+ },
15
+ "vol": {
16
+ "type": "Number",
17
+ "value": 0
18
+ }
19
+ },
20
+ {
21
+ "vol": {
22
+ "type": "Number",
23
+ "value": 100
24
+ },
25
+ "type": "WeatherStation",
26
+ "id": "WeatherStation1"
27
+ },
28
+ {
29
+ "vol": {
30
+ "type": "Number",
31
+ "value": 200
32
+ },
33
+ "type": "WeatherStation",
34
+ "id": "WeatherStation2"
35
+ }
36
+ ]
37
+ }
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "ws11",
6
- "type": "WrongStation"
7
- },
8
4
  {
9
5
  "id": "WrongStation1",
10
6
  "type": "WrongStation",
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "gps1",
6
- "type": "GPS"
7
- },
8
4
  {
9
5
  "explicit": {
10
6
  "type": "number",
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "gps1",
6
- "type": "GPS"
7
- },
8
4
  {
9
5
  "attr1": {
10
6
  "type": "number",
@@ -11,6 +11,10 @@
11
11
  "expectedAtt": {
12
12
  "type": "number",
13
13
  "value": 13
14
+ },
15
+ "alsoexpectedAtt": {
16
+ "value": null,
17
+ "type": "number"
14
18
  }
15
19
  },
16
20
  {
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- { "id": "ws5",
5
- "type": "WeatherStation"
6
- },
7
4
  {
8
5
  "id": "Higro2000",
9
6
  "type": "Higrometer",
@@ -1,17 +1,7 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- { "id": "ws6",
5
- "type": "WeatherStation"
6
- },
7
- {
8
- "id": "Higro2000",
9
- "type": "Higrometer",
10
- "pressure": {
11
- "type": "Hgmm",
12
- "value": "16"
13
- }
14
- },
4
+
15
5
  {
16
6
  "id": "Higro2002",
17
7
  "type": "Higrometer",
@@ -19,6 +9,14 @@
19
9
  "type": "Hgmm",
20
10
  "value": "17"
21
11
  }
22
- }
12
+ },
13
+ {
14
+ "id": "Higro2000",
15
+ "type": "Higrometer",
16
+ "pressure": {
17
+ "type": "Hgmm",
18
+ "value": "16"
19
+ }
20
+ }
23
21
  ]
24
22
  }
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "Sensor",
6
- "type": "Sensor"
7
- },
8
4
  {
9
5
  "vol": {
10
6
  "type": "number",
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "Sensor",
6
- "type": "Sensor"
7
- },
8
4
  {
9
5
  "vol": {
10
6
  "type": "number",
@@ -17,7 +13,7 @@
17
13
  "vol": {
18
14
  "type": "number",
19
15
  "value": "39"
20
- },
16
+ },
21
17
  "type": "WM",
22
18
  "id": "SO2"
23
19
  },
@@ -1,18 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "ws7",
6
- "type": "WeatherStation"
7
- },
8
- {
9
- "pressure": {
10
- "type": "Hgmm",
11
- "value": "16"
12
- },
13
- "type": "Higrometer",
14
- "id": "Higro2000"
15
- },
16
4
  {
17
5
  "pressure": {
18
6
  "type": "Hgmm",
@@ -26,6 +14,14 @@
26
14
  },
27
15
  "type": "Higrometer",
28
16
  "id": "Higro2002"
17
+ },
18
+ {
19
+ "pressure": {
20
+ "type": "Hgmm",
21
+ "value": "16"
22
+ },
23
+ "type": "Higrometer",
24
+ "id": "Higro2000"
29
25
  }
30
26
  ]
31
27
  }
@@ -1,9 +1,5 @@
1
1
  {
2
2
  "entities": [
3
- {
4
- "id": "ws4",
5
- "type": "WeatherStation"
6
- },
7
3
  {
8
4
  "id": "Higro2000",
9
5
  "type": "Higrometer",
@@ -1,14 +1,6 @@
1
1
  {
2
2
  "actionType": "append",
3
3
  "entities": [
4
- {
5
- "id": "ws5",
6
- "type": "WeatherStation",
7
- "TimeInstant": {
8
- "type": "DateTime",
9
- "value": "2018-06-13T13:28:34.611Z"
10
- }
11
- },
12
4
  {
13
5
  "id": "Higro2000",
14
6
  "type": "Higrometer",
@@ -3,7 +3,13 @@
3
3
  "type":"Lamp",
4
4
  "luminosity": {
5
5
  "value": "100",
6
- "type": "text"
6
+ "type": "text",
7
+ "metadata": {
8
+ "unitCode": {
9
+ "type": "Text",
10
+ "value": "CAL"
11
+ }
12
+ }
7
13
  },
8
14
  "controlledProperty": {
9
15
  "value": "StaticValue",