iotagent-node-lib 4.6.0 → 4.7.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 (56) hide show
  1. package/.github/workflows/ci.yml +0 -1
  2. package/Changelog +12 -0
  3. package/config.js +3 -1
  4. package/doc/admin.md +39 -5
  5. package/doc/api.md +67 -6
  6. package/doc/requirements.txt +1 -1
  7. package/lib/commonConfig.js +21 -2
  8. package/lib/model/Command.js +2 -2
  9. package/lib/model/Device.js +7 -3
  10. package/lib/model/Group.js +5 -3
  11. package/lib/model/dbConn.js +53 -112
  12. package/lib/services/commands/commandRegistryMongoDB.js +115 -75
  13. package/lib/services/common/iotManagerService.js +3 -1
  14. package/lib/services/devices/deviceRegistryMemory.js +36 -0
  15. package/lib/services/devices/deviceRegistryMongoDB.js +160 -87
  16. package/lib/services/devices/deviceService.js +33 -3
  17. package/lib/services/devices/devices-NGSI-v2.js +6 -1
  18. package/lib/services/groups/groupRegistryMongoDB.js +120 -83
  19. package/lib/services/ngsi/entities-NGSI-v2.js +14 -1
  20. package/lib/services/ngsi/ngsiService.js +32 -1
  21. package/lib/services/northBound/deviceProvisioningServer.js +12 -3
  22. package/lib/templates/updateDevice.json +12 -0
  23. package/lib/templates/updateDeviceLax.json +12 -0
  24. package/package.json +4 -4
  25. package/test/functional/config-test.js +3 -2
  26. package/test/functional/testUtils.js +2 -2
  27. package/test/unit/examples/groupProvisioningRequests/provisionFullGroup.json +1 -0
  28. package/test/unit/general/config-multi-core-test.js +1 -2
  29. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +5 -4
  30. package/test/unit/general/deviceService-test.js +6 -5
  31. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +6 -5
  32. package/test/unit/mongodb/mongodb-connectionoptions-test.js +7 -39
  33. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1 -2
  34. package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +1 -2
  35. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +8 -5
  36. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +42 -41
  37. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +11 -10
  38. package/test/unit/ngsiv2/general/deviceService-test.js +6 -5
  39. package/test/unit/ngsiv2/general/https-support-test.js +1 -1
  40. package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +4 -3
  41. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +6 -5
  42. package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +17 -16
  43. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +10 -18
  44. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +21 -20
  45. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +8 -7
  46. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +12 -11
  47. package/test/unit/ngsiv2/plugins/custom-plugin_test.js +3 -2
  48. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +28 -27
  49. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +6 -4
  50. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +12 -11
  51. package/test/unit/ngsiv2/provisioning/device-provisioning-configGroup-api_test.js +11 -10
  52. package/test/unit/ngsiv2/provisioning/device-registration_test.js +5 -4
  53. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +6 -5
  54. package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +1 -1
  55. package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +5 -4
  56. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +8 -7
@@ -48,7 +48,8 @@ const iotAgentConfig = {
48
48
  types: {},
49
49
  service: 'smartgondor',
50
50
  subservice: 'gardens',
51
- providerUrl: 'http://smartgondor.com'
51
+ providerUrl: 'http://smartgondor.com',
52
+ useCBflowControl: true
52
53
  };
53
54
 
54
55
  describe('NGSI-v2 - Device provisioning API: Update provisioned devices', function () {
@@ -107,7 +108,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
107
108
  contextBrokerMock
108
109
  .matchHeader('fiware-service', 'smartgondor')
109
110
  .matchHeader('fiware-servicepath', '/gardens')
110
- .post('/v2/entities?options=upsert')
111
+ .post('/v2/entities?options=upsert,flowControl')
111
112
  .reply(204);
112
113
 
113
114
  const nockBody2 = utils.readExampleFile(
@@ -126,7 +127,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
126
127
  contextBrokerMock
127
128
  .matchHeader('fiware-service', 'smartgondor')
128
129
  .matchHeader('fiware-servicepath', '/gardens')
129
- .post('/v2/entities?options=upsert')
130
+ .post('/v2/entities?options=upsert,flowControl')
130
131
  .reply(204);
131
132
 
132
133
  // FIXME: When https://github.com/telefonicaid/fiware-orion/issues/3007 is merged into master branch,
@@ -181,7 +182,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
181
182
  .matchHeader('fiware-service', 'smartgondor')
182
183
  .matchHeader('fiware-servicepath', '/gardens')
183
184
  .post(
184
- '/v2/entities?options=upsert',
185
+ '/v2/entities?options=upsert,flowControl',
185
186
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateProvisionDevice.json')
186
187
  )
187
188
  .reply(204);
@@ -374,7 +375,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
374
375
  contextBrokerMock = nock('http://192.168.1.1:1026')
375
376
  .matchHeader('fiware-service', 'smartgondor')
376
377
  .matchHeader('fiware-servicepath', '/gardens')
377
- .post('/v2/entities?options=upsert')
378
+ .post('/v2/entities?options=upsert,flowControl')
378
379
  .reply(204);
379
380
 
380
381
  contextBrokerMock
@@ -442,7 +443,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
442
443
  contextBrokerMock = nock('http://192.168.1.1:1026')
443
444
  .matchHeader('fiware-service', 'smartgondor')
444
445
  .matchHeader('fiware-servicepath', '/gardens')
445
- .post('/v2/entities?options=upsert')
446
+ .post('/v2/entities?options=upsert,flowControl')
446
447
  .reply(204);
447
448
 
448
449
  contextBrokerMock
@@ -504,7 +505,7 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
504
505
  contextBrokerMock = nock('http://192.168.1.1:1026')
505
506
  .matchHeader('fiware-service', 'smartgondor')
506
507
  .matchHeader('fiware-servicepath', '/gardens')
507
- .post('/v2/entities?options=upsert')
508
+ .post('/v2/entities?options=upsert,flowControl')
508
509
  .reply(204);
509
510
 
510
511
  async.series([iotAgentLib.clearAll, async.apply(request, provisioning4Options)], done);