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
@@ -114,7 +114,8 @@ const iotAgentConfig = {
114
114
  },
115
115
  service: 'smartgondor',
116
116
  subservice: 'gardens',
117
- providerUrl: 'http://smartgondor.com'
117
+ providerUrl: 'http://smartgondor.com',
118
+ useCBflowControl: true
118
119
  };
119
120
  const device1 = {
120
121
  id: 'light1',
@@ -170,7 +171,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
170
171
 
171
172
  describe('When the IoT Agent receives an update on the device data in JSON format', function () {
172
173
  const options = {
173
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
174
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
174
175
  method: 'POST',
175
176
  json: {
176
177
  actionType: 'update',
@@ -208,7 +209,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
208
209
  contextBrokerMock
209
210
  .matchHeader('fiware-service', 'smartgondor')
210
211
  .matchHeader('fiware-servicepath', 'gardens')
211
- .post('/v2/entities?options=upsert')
212
+ .post('/v2/entities?options=upsert,flowControl')
212
213
  .reply(204);
213
214
 
214
215
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)], done);
@@ -279,7 +280,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
279
280
  contextBrokerMock
280
281
  .matchHeader('fiware-service', 'smartgondor')
281
282
  .matchHeader('fiware-servicepath', 'gardens')
282
- .post('/v2/entities?options=upsert')
283
+ .post('/v2/entities?options=upsert,flowControl')
283
284
  .reply(204);
284
285
 
285
286
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)], done);
@@ -341,7 +342,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
341
342
  contextBrokerMock
342
343
  .matchHeader('fiware-service', 'smartgondor')
343
344
  .matchHeader('fiware-servicepath', 'gardens')
344
- .post('/v2/entities?options=upsert')
345
+ .post('/v2/entities?options=upsert,flowControl')
345
346
  .reply(204);
346
347
 
347
348
  async.series(
@@ -414,7 +415,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
414
415
  contextBrokerMock
415
416
  .matchHeader('fiware-service', 'smartgondor')
416
417
  .matchHeader('fiware-servicepath', 'gardens')
417
- .post('/v2/entities?options=upsert')
418
+ .post('/v2/entities?options=upsert,flowControl')
418
419
  .reply(204);
419
420
 
420
421
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)], done);
@@ -485,7 +486,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
485
486
  contextBrokerMock
486
487
  .matchHeader('fiware-service', 'smartgondor')
487
488
  .matchHeader('fiware-servicepath', 'gardens')
488
- .post('/v2/entities?options=upsert')
489
+ .post('/v2/entities?options=upsert,flowControl')
489
490
  .reply(204);
490
491
 
491
492
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device2)], done);
@@ -517,7 +518,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
517
518
  'internalAttributes',
518
519
  function () {
519
520
  const options = {
520
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
521
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
521
522
  method: 'POST',
522
523
  json: {
523
524
  actionType: 'update',
@@ -555,7 +556,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
555
556
  contextBrokerMock
556
557
  .matchHeader('fiware-service', 'smartgondor')
557
558
  .matchHeader('fiware-servicepath', 'gardens')
558
- .post('/v2/entities?options=upsert')
559
+ .post('/v2/entities?options=upsert,flowControl')
559
560
  .reply(204);
560
561
 
561
562
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device3)], done);
@@ -634,7 +635,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
634
635
  contextBrokerMock
635
636
  .matchHeader('fiware-service', 'smartgondor')
636
637
  .matchHeader('fiware-servicepath', 'gardens')
637
- .post('/v2/entities?options=upsert')
638
+ .post('/v2/entities?options=upsert,flowControl')
638
639
  .times(3)
639
640
  .reply(204);
640
641
 
@@ -717,7 +718,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
717
718
  contextBrokerMock
718
719
  .matchHeader('fiware-service', 'smartgondor')
719
720
  .matchHeader('fiware-servicepath', 'gardens')
720
- .post('/v2/entities?options=upsert')
721
+ .post('/v2/entities?options=upsert,flowControl')
721
722
  .times(3)
722
723
  .reply(204);
723
724
 
@@ -789,7 +790,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
789
790
  contextBrokerMock
790
791
  .matchHeader('fiware-service', 'smartgondor')
791
792
  .matchHeader('fiware-servicepath', 'gardens')
792
- .post('/v2/entities?options=upsert')
793
+ .post('/v2/entities?options=upsert,flowControl')
793
794
  .reply(204);
794
795
 
795
796
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)], done);
@@ -852,7 +853,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
852
853
  contextBrokerMock
853
854
  .matchHeader('fiware-service', 'smartgondor')
854
855
  .matchHeader('fiware-servicepath', 'gardens')
855
- .post('/v2/entities?options=upsert')
856
+ .post('/v2/entities?options=upsert,flowControl')
856
857
  .reply(204);
857
858
 
858
859
  iotAgentLib.activate(iotAgentConfig, done);
@@ -917,7 +918,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
917
918
  contextBrokerMock
918
919
  .matchHeader('fiware-service', 'smartgondor')
919
920
  .matchHeader('fiware-servicepath', 'gardens')
920
- .post('/v2/entities?options=upsert')
921
+ .post('/v2/entities?options=upsert,flowControl')
921
922
  .reply(204);
922
923
 
923
924
  iotAgentLib.activate(iotAgentConfig, done);
@@ -984,7 +985,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
984
985
  contextBrokerMock
985
986
  .matchHeader('fiware-service', 'smartgondor')
986
987
  .matchHeader('fiware-servicepath', 'gardens')
987
- .post('/v2/entities?options=upsert')
988
+ .post('/v2/entities?options=upsert,flowControl')
988
989
  .reply(204);
989
990
 
990
991
  async.series([apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)], done);
@@ -1052,7 +1053,7 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
1052
1053
  contextBrokerMock
1053
1054
  .matchHeader('fiware-service', 'smartgondor')
1054
1055
  .matchHeader('fiware-servicepath', 'gardens')
1055
- .post('/v2/entities?options=upsert')
1056
+ .post('/v2/entities?options=upsert,flowControl')
1056
1057
  .reply(204);
1057
1058
 
1058
1059
  iotAgentLib.activate(iotAgentConfig, done);
@@ -126,7 +126,8 @@ const iotAgentConfig = {
126
126
  subservice: 'gardens',
127
127
  providerUrl: 'http://smartgondor.com',
128
128
  pollingExpiration: 200,
129
- pollingDaemonFrequency: 20
129
+ pollingDaemonFrequency: 20,
130
+ useCBflowControl: true
130
131
  };
131
132
  const device3 = {
132
133
  id: 'r2d2',
@@ -158,7 +159,7 @@ describe('NGSI-v2 - Polling commands', function () {
158
159
  contextBrokerMock
159
160
  .matchHeader('fiware-service', 'smartgondor')
160
161
  .matchHeader('fiware-servicepath', 'gardens')
161
- .post('/v2/entities?options=upsert')
162
+ .post('/v2/entities?options=upsert,flowControl')
162
163
  .reply(204);
163
164
 
164
165
  iotAgentLib.activate(iotAgentConfig, done);
@@ -180,7 +181,7 @@ describe('NGSI-v2 - Polling commands', function () {
180
181
 
181
182
  describe('When a command update arrives to the IoT Agent for a device with polling', function () {
182
183
  const options = {
183
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
184
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
184
185
  method: 'POST',
185
186
  json: {
186
187
  actionType: 'update',
@@ -264,7 +265,7 @@ describe('NGSI-v2 - Polling commands', function () {
264
265
 
265
266
  describe('When a command arrives with multiple values in the value field', function () {
266
267
  const options = {
267
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
268
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
268
269
  method: 'POST',
269
270
  json: {
270
271
  actionType: 'update',
@@ -293,7 +294,7 @@ describe('NGSI-v2 - Polling commands', function () {
293
294
  .matchHeader('fiware-service', 'smartgondor')
294
295
  .matchHeader('fiware-servicepath', 'gardens')
295
296
  .post(
296
- '/v2/entities?options=upsert',
297
+ '/v2/entities?options=upsert,flowControl',
297
298
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json')
298
299
  )
299
300
  .reply(204);
@@ -320,7 +321,7 @@ describe('NGSI-v2 - Polling commands', function () {
320
321
 
321
322
  describe('When a polling command expires', function () {
322
323
  const options = {
323
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
324
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
324
325
  method: 'POST',
325
326
  json: {
326
327
  actionType: 'update',
@@ -346,16 +347,7 @@ describe('NGSI-v2 - Polling commands', function () {
346
347
  .matchHeader('fiware-service', 'smartgondor')
347
348
  .matchHeader('fiware-servicepath', 'gardens')
348
349
  .post(
349
- '/v2/entities?options=upsert',
350
- utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json')
351
- )
352
- .reply(204);
353
-
354
- statusAttributeMock = nock('http://192.168.1.1:1026')
355
- .matchHeader('fiware-service', 'smartgondor')
356
- .matchHeader('fiware-servicepath', 'gardens')
357
- .post(
358
- '/v2/entities?options=upsert',
350
+ '/v2/entities?options=upsert,flowControl',
359
351
  utils.readExampleFile(
360
352
  './test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json'
361
353
  )
@@ -415,7 +407,7 @@ describe('NGSI-v2 - Polling commands expressions', function () {
415
407
  contextBrokerMock
416
408
  .matchHeader('fiware-service', 'smartgondor')
417
409
  .matchHeader('fiware-servicepath', 'gardens')
418
- .post('/v2/entities?options=upsert')
410
+ .post('/v2/entities?options=upsert,flowControl')
419
411
  .reply(204);
420
412
 
421
413
  iotAgentConfig.pollingExpiration = 0;
@@ -439,7 +431,7 @@ describe('NGSI-v2 - Polling commands expressions', function () {
439
431
 
440
432
  describe('When a command update arrives to the IoT Agent for a device with polling', function () {
441
433
  const options = {
442
- url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update',
434
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/v2/op/update?options=flowControl',
443
435
  method: 'POST',
444
436
  json: {
445
437
  actionType: 'update',
@@ -206,7 +206,8 @@ const iotAgentConfig = {
206
206
  },
207
207
  service: 'smartgondor',
208
208
  subservice: 'gardens',
209
- providerUrl: 'http://smartgondor.com'
209
+ providerUrl: 'http://smartgondor.com',
210
+ useCBflowControl: true
210
211
  };
211
212
 
212
213
  describe('NGSI-v2 - Active attributes test', function () {
@@ -239,7 +240,7 @@ describe('NGSI-v2 - Active attributes test', function () {
239
240
  .matchHeader('fiware-service', 'smartgondor')
240
241
  .matchHeader('fiware-servicepath', 'gardens')
241
242
  .post(
242
- '/v2/entities?options=upsert',
243
+ '/v2/entities?options=upsert,flowControl',
243
244
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
244
245
  )
245
246
  .reply(204);
@@ -283,7 +284,7 @@ describe('NGSI-v2 - Active attributes test', function () {
283
284
  .matchHeader('fiware-service', 'smartgondor')
284
285
  .matchHeader('fiware-servicepath', 'gardens')
285
286
  .post(
286
- '/v2/entities?options=upsert',
287
+ '/v2/entities?options=upsert,flowControl',
287
288
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json')
288
289
  )
289
290
  .reply(204);
@@ -331,7 +332,7 @@ describe('NGSI-v2 - Active attributes test', function () {
331
332
  .matchHeader('fiware-service', 'smartgondor')
332
333
  .matchHeader('fiware-servicepath', 'gardens')
333
334
  .post(
334
- '/v2/entities?options=upsert',
335
+ '/v2/entities?options=upsert,flowControl',
335
336
  utils.readExampleFile(
336
337
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json'
337
338
  )
@@ -383,7 +384,7 @@ describe('NGSI-v2 - Active attributes test', function () {
383
384
  .matchHeader('fiware-service', 'smartgondor')
384
385
  .matchHeader('fiware-servicepath', 'gardens')
385
386
  .post(
386
- '/v2/entities?options=upsert',
387
+ '/v2/entities?options=upsert,flowControl',
387
388
  utils.readExampleFile(
388
389
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json'
389
390
  )
@@ -475,7 +476,7 @@ describe('NGSI-v2 - Active attributes test', function () {
475
476
  .matchHeader('fiware-service', 'smartgondor')
476
477
  .matchHeader('fiware-servicepath', 'gardens')
477
478
  .post(
478
- '/v2/entities?options=upsert',
479
+ '/v2/entities?options=upsert,flowControl',
479
480
  utils.readExampleFile(
480
481
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json'
481
482
  )
@@ -529,7 +530,7 @@ describe('NGSI-v2 - Active attributes test', function () {
529
530
  .matchHeader('fiware-service', 'smartgondor')
530
531
  .matchHeader('fiware-servicepath', 'gardens')
531
532
  .post(
532
- '/v2/entities?options=upsert',
533
+ '/v2/entities?options=upsert,flowControl',
533
534
  utils.readExampleFile(
534
535
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json'
535
536
  )
@@ -585,7 +586,7 @@ describe('NGSI-v2 - Active attributes test', function () {
585
586
  .matchHeader('fiware-service', 'smartgondor')
586
587
  .matchHeader('fiware-servicepath', 'gardens')
587
588
  .post(
588
- '/v2/entities?options=upsert',
589
+ '/v2/entities?options=upsert,flowControl',
589
590
  utils.readExampleFile(
590
591
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json'
591
592
  )
@@ -639,7 +640,7 @@ describe('NGSI-v2 - Active attributes test', function () {
639
640
  .matchHeader('fiware-service', 'smartgondor')
640
641
  .matchHeader('fiware-servicepath', 'gardens')
641
642
  .post(
642
- '/v2/entities?options=upsert',
643
+ '/v2/entities?options=upsert,flowControl',
643
644
  utils.readExampleFile(
644
645
  './test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json'
645
646
  )
@@ -693,7 +694,7 @@ describe('NGSI-v2 - Active attributes test', function () {
693
694
  .matchHeader('fiware-service', 'smartgondor')
694
695
  .matchHeader('fiware-servicepath', 'gardens')
695
696
  .post(
696
- '/v2/entities?options=upsert',
697
+ '/v2/entities?options=upsert,flowControl',
697
698
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
698
699
  )
699
700
  .reply(
@@ -725,7 +726,7 @@ describe('NGSI-v2 - Active attributes test', function () {
725
726
  .matchHeader('fiware-service', 'smartgondor')
726
727
  .matchHeader('fiware-servicepath', 'gardens')
727
728
  .post(
728
- '/v2/entities?options=upsert',
729
+ '/v2/entities?options=upsert,flowControl',
729
730
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
730
731
  )
731
732
  .reply(
@@ -754,7 +755,7 @@ describe('NGSI-v2 - Active attributes test', function () {
754
755
  .matchHeader('fiware-service', 'smartgondor')
755
756
  .matchHeader('fiware-servicepath', 'gardens')
756
757
  .post(
757
- '/v2/entities?options=upsert',
758
+ '/v2/entities?options=upsert,flowControl',
758
759
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
759
760
  )
760
761
  .reply(
@@ -786,7 +787,7 @@ describe('NGSI-v2 - Active attributes test', function () {
786
787
  .matchHeader('fiware-service', 'smartgondor')
787
788
  .matchHeader('fiware-servicepath', 'gardens')
788
789
  .post(
789
- '/v2/entities?options=upsert',
790
+ '/v2/entities?options=upsert,flowControl',
790
791
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext5.json')
791
792
  )
792
793
  .reply(204);
@@ -819,7 +820,7 @@ describe('NGSI-v2 - Active attributes test', function () {
819
820
  .matchHeader('fiware-service', 'smartgondor')
820
821
  .matchHeader('fiware-servicepath', 'gardens')
821
822
  .post(
822
- '/v2/entities?options=upsert',
823
+ '/v2/entities?options=upsert,flowControl',
823
824
  utils.readExampleFile(
824
825
  './test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json'
825
826
  )
@@ -854,7 +855,7 @@ describe('NGSI-v2 - Active attributes test', function () {
854
855
  .matchHeader('fiware-service', 'smartgondor')
855
856
  .matchHeader('fiware-servicepath', 'gardens')
856
857
  .post(
857
- '/v2/entities?options=upsert',
858
+ '/v2/entities?options=upsert,flowControl',
858
859
  utils.readExampleFile(
859
860
  './test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json'
860
861
  )
@@ -880,7 +881,7 @@ describe('NGSI-v2 - Active attributes test', function () {
880
881
  .matchHeader('fiware-service', 'smartgondor')
881
882
  .matchHeader('fiware-servicepath', 'gardens')
882
883
  .post(
883
- '/v2/entities?options=upsert',
884
+ '/v2/entities?options=upsert,flowControl',
884
885
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
885
886
  )
886
887
  .reply(204);
@@ -929,7 +930,7 @@ describe('NGSI-v2 - Active attributes test', function () {
929
930
  contextBrokerMock = nock('http://192.168.1.1:1026')
930
931
  .matchHeader('fiware-service', 'smartgondor')
931
932
  .matchHeader('fiware-servicepath', 'gardens')
932
- .post('/v2/entities?options=upsert', {
933
+ .post('/v2/entities?options=upsert,flowControl', {
933
934
  id: 'stupiddevice1',
934
935
  type: 'StupidDevice',
935
936
  meas: {
@@ -984,7 +985,7 @@ describe('NGSI-v2 - Active attributes test', function () {
984
985
  contextBrokerMock = nock('http://192.168.1.1:1026')
985
986
  .matchHeader('fiware-service', 'smartgondor')
986
987
  .matchHeader('fiware-servicepath', 'gardens')
987
- .post('/v2/entities?options=upsert', {
988
+ .post('/v2/entities?options=upsert,flowControl', {
988
989
  id: 'stupiddevice2',
989
990
  type: 'StupidDevice',
990
991
  meas: {
@@ -1031,7 +1032,7 @@ describe('NGSI-v2 - Active attributes test', function () {
1031
1032
  contextBrokerMock = nock('http://192.168.1.1:1026')
1032
1033
  .matchHeader('fiware-service', 'smartgondor')
1033
1034
  .matchHeader('fiware-servicepath', 'gardens')
1034
- .post('/v2/entities?options=upsert', {
1035
+ .post('/v2/entities?options=upsert,flowControl', {
1035
1036
  id: 'stupiddevice3',
1036
1037
  type: 'StupidDevice2',
1037
1038
  meas: {
@@ -1071,7 +1072,7 @@ describe('NGSI-v2 - Active attributes test', function () {
1071
1072
  .matchHeader('fiware-service', 'smartgondor')
1072
1073
  .matchHeader('fiware-servicepath', 'gardens')
1073
1074
  .post(
1074
- '/v2/entities?options=upsert',
1075
+ '/v2/entities?options=upsert,flowControl',
1075
1076
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext6.json')
1076
1077
  )
1077
1078
  .reply(204);
@@ -176,7 +176,8 @@ const iotAgentConfig = {
176
176
  timestamp: true,
177
177
  service: 'smartgondor',
178
178
  subservice: 'gardens',
179
- providerUrl: 'http://smartgondor.com'
179
+ providerUrl: 'http://smartgondor.com',
180
+ useCBflowControl: true
180
181
  };
181
182
 
182
183
  describe('NGSI-v2 - Static attributes test', function () {
@@ -208,10 +209,10 @@ describe('NGSI-v2 - Static attributes test', function () {
208
209
  contextBrokerMock = nock('http://192.168.1.1:1026')
209
210
  .matchHeader('fiware-service', 'smartgondor')
210
211
  .matchHeader('fiware-servicepath', 'gardens')
211
- .post('/v2/entities?options=upsert')
212
+ .post('/v2/entities?options=upsert,flowControl')
212
213
  .times(4)
213
214
  .reply(204)
214
- .post('/v2/entities?options=upsert', function (body) {
215
+ .post('/v2/entities?options=upsert,flowControl', function (body) {
215
216
  let metadatas = 0;
216
217
  for (const i in body) {
217
218
  if (body[i].metadata) {
@@ -258,7 +259,7 @@ describe('NGSI-v2 - Static attributes test', function () {
258
259
  contextBrokerMock = nock('http://192.168.1.1:1026')
259
260
  .matchHeader('fiware-service', 'smartgondor')
260
261
  .matchHeader('fiware-servicepath', 'gardens')
261
- .post('/v2/entities?options=upsert', {
262
+ .post('/v2/entities?options=upsert,flowControl', {
262
263
  id: 'light2',
263
264
  type: 'Light_Explicit_True',
264
265
  pressure: {
@@ -303,7 +304,7 @@ describe('NGSI-v2 - Static attributes test', function () {
303
304
  contextBrokerMock = nock('http://192.168.1.1:1026')
304
305
  .matchHeader('fiware-service', 'smartgondor')
305
306
  .matchHeader('fiware-servicepath', 'gardens')
306
- .post('/v2/entities?options=upsert', {
307
+ .post('/v2/entities?options=upsert,flowControl', {
307
308
  id: 'light2',
308
309
  type: 'Light_Explicit_True',
309
310
  pressure: {
@@ -347,7 +348,7 @@ describe('NGSI-v2 - Static attributes test', function () {
347
348
  contextBrokerMock = nock('http://192.168.1.1:1026')
348
349
  .matchHeader('fiware-service', 'smartgondor')
349
350
  .matchHeader('fiware-servicepath', 'gardens')
350
- .post('/v2/entities?options=upsert', {
351
+ .post('/v2/entities?options=upsert,flowControl', {
351
352
  id: 'light2',
352
353
  type: 'Light_Explicit_Array',
353
354
  pressure: {
@@ -388,7 +389,7 @@ describe('NGSI-v2 - Static attributes test', function () {
388
389
  contextBrokerMock = nock('http://192.168.1.1:1026')
389
390
  .matchHeader('fiware-service', 'smartgondor')
390
391
  .matchHeader('fiware-servicepath', 'gardens')
391
- .post('/v2/entities?options=upsert', {
392
+ .post('/v2/entities?options=upsert,flowControl', {
392
393
  id: 'light2',
393
394
  type: 'Light_Explicit_Expression',
394
395
  pressure: {
@@ -107,7 +107,8 @@ const iotAgentConfig = {
107
107
  },
108
108
  service: 'smartgondor',
109
109
  subservice: 'gardens',
110
- providerUrl: 'http://smartgondor.com'
110
+ providerUrl: 'http://smartgondor.com',
111
+ useCBflowControl: true
111
112
  };
112
113
 
113
114
  describe('NGSI-v2 - Attribute alias plugin', function () {
@@ -146,7 +147,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
146
147
  .matchHeader('fiware-service', 'smartgondor')
147
148
  .matchHeader('fiware-servicepath', 'gardens')
148
149
  .post(
149
- '/v2/entities?options=upsert',
150
+ '/v2/entities?options=upsert,flowControl',
150
151
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json')
151
152
  )
152
153
  .reply(204);
@@ -176,7 +177,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
176
177
  .matchHeader('fiware-service', 'smartgondor')
177
178
  .matchHeader('fiware-servicepath', 'gardens')
178
179
  .post(
179
- '/v2/entities?options=upsert',
180
+ '/v2/entities?options=upsert,flowControl',
180
181
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json')
181
182
  )
182
183
  .reply(204);
@@ -206,7 +207,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
206
207
  .matchHeader('fiware-service', 'smartgondor')
207
208
  .matchHeader('fiware-servicepath', 'gardens')
208
209
  .post(
209
- '/v2/entities?options=upsert',
210
+ '/v2/entities?options=upsert,flowControl',
210
211
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json')
211
212
  )
212
213
  .reply(204);
@@ -237,7 +238,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
237
238
  .matchHeader('fiware-service', 'smartgondor')
238
239
  .matchHeader('fiware-servicepath', 'gardens')
239
240
  .post(
240
- '/v2/entities?options=upsert',
241
+ '/v2/entities?options=upsert,flowControl',
241
242
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json')
242
243
  )
243
244
  .reply(204);
@@ -268,7 +269,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
268
269
  .matchHeader('fiware-service', 'smartgondor')
269
270
  .matchHeader('fiware-servicepath', 'gardens')
270
271
  .post(
271
- '/v2/entities?options=upsert',
272
+ '/v2/entities?options=upsert,flowControl',
272
273
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json')
273
274
  )
274
275
  .reply(204);
@@ -299,7 +300,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
299
300
  .matchHeader('fiware-service', 'smartgondor')
300
301
  .matchHeader('fiware-servicepath', 'gardens')
301
302
  .post(
302
- '/v2/entities?options=upsert',
303
+ '/v2/entities?options=upsert,flowControl',
303
304
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json')
304
305
  )
305
306
  .reply(204);
@@ -329,7 +330,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
329
330
  .matchHeader('fiware-service', 'smartgondor')
330
331
  .matchHeader('fiware-servicepath', 'gardens')
331
332
  .post(
332
- '/v2/entities?options=upsert',
333
+ '/v2/entities?options=upsert,flowControl',
333
334
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json')
334
335
  )
335
336
  .reply(204);
@@ -360,7 +361,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
360
361
  .matchHeader('fiware-service', 'smartgondor')
361
362
  .matchHeader('fiware-servicepath', 'gardens')
362
363
  .post(
363
- '/v2/entities?options=upsert',
364
+ '/v2/entities?options=upsert,flowControl',
364
365
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json')
365
366
  )
366
367
  .reply(204);
@@ -391,7 +392,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
391
392
  .matchHeader('fiware-service', 'smartgondor')
392
393
  .matchHeader('fiware-servicepath', 'gardens')
393
394
  .post(
394
- '/v2/entities?options=upsert',
395
+ '/v2/entities?options=upsert,flowControl',
395
396
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json')
396
397
  )
397
398
  .reply(204);
@@ -422,7 +423,7 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
422
423
  .matchHeader('fiware-service', 'smartgondor')
423
424
  .matchHeader('fiware-servicepath', 'gardens')
424
425
  .post(
425
- '/v2/entities?options=upsert',
426
+ '/v2/entities?options=upsert,flowControl',
426
427
  utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json')
427
428
  )
428
429
  .reply(204);
@@ -57,7 +57,8 @@ const iotAgentConfig = {
57
57
  },
58
58
  service: 'smartgondor',
59
59
  subservice: 'gardens',
60
- providerUrl: 'http://smartgondor.com'
60
+ providerUrl: 'http://smartgondor.com',
61
+ useCBflowControl: true
61
62
  };
62
63
 
63
64
  describe('NGSI-v2 - Custom plugin', function () {
@@ -111,7 +112,7 @@ describe('NGSI-v2 - Custom plugin', function () {
111
112
  contextBrokerMock = nock('http://192.168.1.1:1026')
112
113
  .matchHeader('fiware-service', 'smartgondor')
113
114
  .matchHeader('fiware-servicepath', 'gardens')
114
- .post('/v2/entities?options=upsert')
115
+ .post('/v2/entities?options=upsert,flowControl')
115
116
  .reply(204);
116
117
  });
117
118