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.
- package/.github/workflows/ci.yml +0 -1
- package/Changelog +12 -0
- package/config.js +3 -1
- package/doc/admin.md +39 -5
- package/doc/api.md +67 -6
- package/doc/requirements.txt +1 -1
- package/lib/commonConfig.js +21 -2
- package/lib/model/Command.js +2 -2
- package/lib/model/Device.js +7 -3
- package/lib/model/Group.js +5 -3
- package/lib/model/dbConn.js +53 -112
- package/lib/services/commands/commandRegistryMongoDB.js +115 -75
- package/lib/services/common/iotManagerService.js +3 -1
- package/lib/services/devices/deviceRegistryMemory.js +36 -0
- package/lib/services/devices/deviceRegistryMongoDB.js +160 -87
- package/lib/services/devices/deviceService.js +33 -3
- package/lib/services/devices/devices-NGSI-v2.js +6 -1
- package/lib/services/groups/groupRegistryMongoDB.js +120 -83
- package/lib/services/ngsi/entities-NGSI-v2.js +14 -1
- package/lib/services/ngsi/ngsiService.js +32 -1
- package/lib/services/northBound/deviceProvisioningServer.js +12 -3
- package/lib/templates/updateDevice.json +12 -0
- package/lib/templates/updateDeviceLax.json +12 -0
- package/package.json +4 -4
- package/test/functional/config-test.js +3 -2
- package/test/functional/testUtils.js +2 -2
- package/test/unit/examples/groupProvisioningRequests/provisionFullGroup.json +1 -0
- package/test/unit/general/config-multi-core-test.js +1 -2
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +5 -4
- package/test/unit/general/deviceService-test.js +6 -5
- package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +6 -5
- package/test/unit/mongodb/mongodb-connectionoptions-test.js +7 -39
- package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1 -2
- package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +1 -2
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +8 -5
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +42 -41
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +11 -10
- package/test/unit/ngsiv2/general/deviceService-test.js +6 -5
- package/test/unit/ngsiv2/general/https-support-test.js +1 -1
- package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +4 -3
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +6 -5
- package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +17 -16
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +10 -18
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +21 -20
- package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +8 -7
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +12 -11
- package/test/unit/ngsiv2/plugins/custom-plugin_test.js +3 -2
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +28 -27
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +6 -4
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +12 -11
- package/test/unit/ngsiv2/provisioning/device-provisioning-configGroup-api_test.js +11 -10
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +5 -4
- package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +6 -5
- package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +1 -1
- package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +5 -4
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +8 -7
|
@@ -633,7 +633,8 @@ const iotAgentConfig = {
|
|
|
633
633
|
},
|
|
634
634
|
service: 'smartgondor',
|
|
635
635
|
subservice: 'gardens',
|
|
636
|
-
providerUrl: 'http://smartgondor.com'
|
|
636
|
+
providerUrl: 'http://smartgondor.com',
|
|
637
|
+
useCBflowControl: true
|
|
637
638
|
};
|
|
638
639
|
|
|
639
640
|
describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
@@ -674,7 +675,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
674
675
|
.matchHeader('fiware-service', 'smartgondor')
|
|
675
676
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
676
677
|
.post(
|
|
677
|
-
'/v2/op/update',
|
|
678
|
+
'/v2/op/update?options=flowControl',
|
|
678
679
|
utils.readExampleFile(
|
|
679
680
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json'
|
|
680
681
|
)
|
|
@@ -712,7 +713,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
712
713
|
.matchHeader('fiware-service', 'smartgondor')
|
|
713
714
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
714
715
|
.post(
|
|
715
|
-
'/v2/op/update',
|
|
716
|
+
'/v2/op/update?options=flowControl',
|
|
716
717
|
utils.readExampleFile(
|
|
717
718
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin17.json'
|
|
718
719
|
)
|
|
@@ -744,7 +745,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
744
745
|
.matchHeader('fiware-service', 'smartgondor')
|
|
745
746
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
746
747
|
.post(
|
|
747
|
-
'/v2/op/update',
|
|
748
|
+
'/v2/op/update?options=flowControl',
|
|
748
749
|
utils.readExampleFile(
|
|
749
750
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json'
|
|
750
751
|
)
|
|
@@ -781,7 +782,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
781
782
|
.matchHeader('fiware-service', 'smartgondor')
|
|
782
783
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
783
784
|
.post(
|
|
784
|
-
'/v2/op/update',
|
|
785
|
+
'/v2/op/update?options=flowControl',
|
|
785
786
|
utils.readExampleFile(
|
|
786
787
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json'
|
|
787
788
|
)
|
|
@@ -819,7 +820,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
819
820
|
.matchHeader('fiware-service', 'smartgondor')
|
|
820
821
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
821
822
|
.post(
|
|
822
|
-
'/v2/op/update',
|
|
823
|
+
'/v2/op/update?options=flowControl',
|
|
823
824
|
utils.readExampleFile(
|
|
824
825
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json'
|
|
825
826
|
)
|
|
@@ -862,7 +863,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
862
863
|
.matchHeader('fiware-service', 'smartgondor')
|
|
863
864
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
864
865
|
.post(
|
|
865
|
-
'/v2/op/update',
|
|
866
|
+
'/v2/op/update?options=flowControl',
|
|
866
867
|
utils.readExampleFile(
|
|
867
868
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin3.json'
|
|
868
869
|
)
|
|
@@ -905,7 +906,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
905
906
|
.matchHeader('fiware-service', 'smartgondor')
|
|
906
907
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
907
908
|
.post(
|
|
908
|
-
'/v2/op/update',
|
|
909
|
+
'/v2/op/update?options=flowControl',
|
|
909
910
|
utils.readExampleFile(
|
|
910
911
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json'
|
|
911
912
|
)
|
|
@@ -948,7 +949,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
948
949
|
.matchHeader('fiware-service', 'smartgondor')
|
|
949
950
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
950
951
|
.post(
|
|
951
|
-
'/v2/op/update',
|
|
952
|
+
'/v2/op/update?options=flowControl',
|
|
952
953
|
utils.readExampleFile(
|
|
953
954
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json'
|
|
954
955
|
)
|
|
@@ -996,7 +997,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
996
997
|
.matchHeader('fiware-service', 'smartgondor')
|
|
997
998
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
998
999
|
.post(
|
|
999
|
-
'/v2/op/update',
|
|
1000
|
+
'/v2/op/update?options=flowControl',
|
|
1000
1001
|
utils.readExampleFile(
|
|
1001
1002
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json'
|
|
1002
1003
|
)
|
|
@@ -1044,7 +1045,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1044
1045
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1045
1046
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1046
1047
|
.post(
|
|
1047
|
-
'/v2/op/update',
|
|
1048
|
+
'/v2/op/update?options=flowControl',
|
|
1048
1049
|
utils.readExampleFile(
|
|
1049
1050
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json'
|
|
1050
1051
|
)
|
|
@@ -1077,7 +1078,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1077
1078
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1078
1079
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1079
1080
|
.post(
|
|
1080
|
-
'/v2/op/update',
|
|
1081
|
+
'/v2/op/update?options=flowControl',
|
|
1081
1082
|
utils.readExampleFile(
|
|
1082
1083
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json'
|
|
1083
1084
|
)
|
|
@@ -1120,7 +1121,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1120
1121
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1121
1122
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1122
1123
|
.post(
|
|
1123
|
-
'/v2/op/update',
|
|
1124
|
+
'/v2/op/update?options=flowControl',
|
|
1124
1125
|
utils.readExampleFile(
|
|
1125
1126
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json'
|
|
1126
1127
|
)
|
|
@@ -1153,7 +1154,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1153
1154
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1154
1155
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1155
1156
|
.post(
|
|
1156
|
-
'/v2/op/update',
|
|
1157
|
+
'/v2/op/update?options=flowControl',
|
|
1157
1158
|
utils.readExampleFile(
|
|
1158
1159
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10b.json'
|
|
1159
1160
|
)
|
|
@@ -1177,7 +1178,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1177
1178
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1178
1179
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1179
1180
|
.post(
|
|
1180
|
-
'/v2/op/update',
|
|
1181
|
+
'/v2/op/update?options=flowControl',
|
|
1181
1182
|
utils.readExampleFile(
|
|
1182
1183
|
// Updated test same case that updateContextMultientityPlugin4.json
|
|
1183
1184
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json'
|
|
@@ -1211,7 +1212,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1211
1212
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1212
1213
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1213
1214
|
.post(
|
|
1214
|
-
'/v2/op/update',
|
|
1215
|
+
'/v2/op/update?options=flowControl',
|
|
1215
1216
|
utils.readExampleFile(
|
|
1216
1217
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json'
|
|
1217
1218
|
)
|
|
@@ -1249,7 +1250,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1249
1250
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1250
1251
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1251
1252
|
.post(
|
|
1252
|
-
'/v2/op/update',
|
|
1253
|
+
'/v2/op/update?options=flowControl',
|
|
1253
1254
|
utils.readExampleFile(
|
|
1254
1255
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json'
|
|
1255
1256
|
)
|
|
@@ -1291,7 +1292,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1291
1292
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1292
1293
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1293
1294
|
.post(
|
|
1294
|
-
'/v2/op/update',
|
|
1295
|
+
'/v2/op/update?options=flowControl',
|
|
1295
1296
|
utils.readExampleFile(
|
|
1296
1297
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json'
|
|
1297
1298
|
)
|
|
@@ -1333,7 +1334,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1333
1334
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1334
1335
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1335
1336
|
.post(
|
|
1336
|
-
'/v2/op/update',
|
|
1337
|
+
'/v2/op/update?options=flowControl',
|
|
1337
1338
|
utils.readExampleFile(
|
|
1338
1339
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json'
|
|
1339
1340
|
)
|
|
@@ -1375,7 +1376,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1375
1376
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1376
1377
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1377
1378
|
.post(
|
|
1378
|
-
'/v2/op/update',
|
|
1379
|
+
'/v2/op/update?options=flowControl',
|
|
1379
1380
|
utils.readExampleFile(
|
|
1380
1381
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json'
|
|
1381
1382
|
)
|
|
@@ -1410,7 +1411,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1410
1411
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1411
1412
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1412
1413
|
.post(
|
|
1413
|
-
'/v2/op/update',
|
|
1414
|
+
'/v2/op/update?options=flowControl',
|
|
1414
1415
|
utils.readExampleFile(
|
|
1415
1416
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json'
|
|
1416
1417
|
)
|
|
@@ -1461,7 +1462,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1461
1462
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1462
1463
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1463
1464
|
.post(
|
|
1464
|
-
'/v2/op/update',
|
|
1465
|
+
'/v2/op/update?options=flowControl',
|
|
1465
1466
|
utils.readExampleFile(
|
|
1466
1467
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json'
|
|
1467
1468
|
)
|
|
@@ -1500,7 +1501,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
1500
1501
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1501
1502
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1502
1503
|
.post(
|
|
1503
|
-
'/v2/op/update',
|
|
1504
|
+
'/v2/op/update?options=flowControl',
|
|
1504
1505
|
utils.readExampleFile(
|
|
1505
1506
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json'
|
|
1506
1507
|
)
|
|
@@ -1570,7 +1571,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
1570
1571
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1571
1572
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1572
1573
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1573
|
-
.post('/v2/op/update', function (body) {
|
|
1574
|
+
.post('/v2/op/update?options=flowControl', function (body) {
|
|
1574
1575
|
const expectedBody = utils.readExampleFile(
|
|
1575
1576
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json'
|
|
1576
1577
|
);
|
|
@@ -1608,7 +1609,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
1608
1609
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1609
1610
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1610
1611
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1611
|
-
.post('/v2/op/update', function (body) {
|
|
1612
|
+
.post('/v2/op/update?options=flowControl', function (body) {
|
|
1612
1613
|
const expectedBody = utils.readExampleFile(
|
|
1613
1614
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json'
|
|
1614
1615
|
);
|
|
@@ -1647,7 +1648,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
1647
1648
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1648
1649
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1649
1650
|
.post(
|
|
1650
|
-
'/v2/op/update',
|
|
1651
|
+
'/v2/op/update?options=flowControl',
|
|
1651
1652
|
utils.readExampleFile(
|
|
1652
1653
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json'
|
|
1653
1654
|
)
|
|
@@ -1701,7 +1702,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed for a command update for a r
|
|
|
1701
1702
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1702
1703
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1703
1704
|
.post(
|
|
1704
|
-
'/v2/entities?options=upsert',
|
|
1705
|
+
'/v2/entities?options=upsert,flowControl',
|
|
1705
1706
|
utils.readExampleFile(
|
|
1706
1707
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json'
|
|
1707
1708
|
)
|
|
@@ -50,7 +50,8 @@ const iotAgentConfig = {
|
|
|
50
50
|
service: 'smartgondor',
|
|
51
51
|
subservice: 'gardens',
|
|
52
52
|
providerUrl: 'http://smartgondor.com',
|
|
53
|
-
deviceRegistrationDuration: 'P1M'
|
|
53
|
+
deviceRegistrationDuration: 'P1M',
|
|
54
|
+
useCBflowControl: true
|
|
54
55
|
};
|
|
55
56
|
const optionsCreation = {
|
|
56
57
|
url: 'http://localhost:4041/iot/services',
|
|
@@ -65,6 +66,7 @@ const optionsCreation = {
|
|
|
65
66
|
cbHost: 'http://unexistentHost:1026',
|
|
66
67
|
transport: 'HTTP',
|
|
67
68
|
endpoint: 'http://myendpoint.com',
|
|
69
|
+
useCBflowControl: true,
|
|
68
70
|
commands: [
|
|
69
71
|
{
|
|
70
72
|
name: 'wheel1',
|
|
@@ -519,7 +521,7 @@ describe('NGSI-v2 - Device Group Configuration API', function () {
|
|
|
519
521
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
520
522
|
.matchHeader('fiware-service', 'testservice')
|
|
521
523
|
.matchHeader('fiware-servicepath', '/testingPath')
|
|
522
|
-
.post('/v2/entities?options=upsert')
|
|
524
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
523
525
|
.reply(204);
|
|
524
526
|
|
|
525
527
|
contextBrokerMock
|
|
@@ -537,7 +539,7 @@ describe('NGSI-v2 - Device Group Configuration API', function () {
|
|
|
537
539
|
contextBrokerMock
|
|
538
540
|
.matchHeader('fiware-service', 'testservice')
|
|
539
541
|
.matchHeader('fiware-servicepath', '/testingPath')
|
|
540
|
-
.post('/v2/entities?options=upsert')
|
|
542
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
541
543
|
.reply(204);
|
|
542
544
|
|
|
543
545
|
async.series(
|
|
@@ -1091,7 +1093,7 @@ describe('NGSI-v2 - Device Group Configuration API', function () {
|
|
|
1091
1093
|
.matchHeader('fiware-service', 'testservice')
|
|
1092
1094
|
.matchHeader('fiware-servicepath', '/testingPath')
|
|
1093
1095
|
.post(
|
|
1094
|
-
'/v2/entities?options=upsert',
|
|
1096
|
+
'/v2/entities?options=upsert,flowControl',
|
|
1095
1097
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json')
|
|
1096
1098
|
)
|
|
1097
1099
|
.reply(204, {});
|
|
@@ -49,7 +49,8 @@ const iotAgentConfig = {
|
|
|
49
49
|
service: 'smartgondor',
|
|
50
50
|
subservice: 'gardens',
|
|
51
51
|
providerUrl: 'http://smartgondor.com',
|
|
52
|
-
explicitAttrs: false
|
|
52
|
+
explicitAttrs: false,
|
|
53
|
+
useCBflowControl: true
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
@@ -74,7 +75,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
74
75
|
contextBrokerMock
|
|
75
76
|
.matchHeader('fiware-service', 'smartgondor')
|
|
76
77
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
77
|
-
.post('/v2/entities?options=upsert')
|
|
78
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
78
79
|
.reply(204);
|
|
79
80
|
|
|
80
81
|
iotAgentLib.clearAll(done);
|
|
@@ -419,7 +420,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
419
420
|
.matchHeader('fiware-service', 'smartgondor')
|
|
420
421
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
421
422
|
.post(
|
|
422
|
-
'/v2/entities?options=upsert',
|
|
423
|
+
'/v2/entities?options=upsert,flowControl',
|
|
423
424
|
utils.readExampleFile(
|
|
424
425
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
425
426
|
)
|
|
@@ -491,7 +492,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
491
492
|
.matchHeader('fiware-service', 'smartgondor')
|
|
492
493
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
493
494
|
.post(
|
|
494
|
-
'/v2/entities?options=upsert',
|
|
495
|
+
'/v2/entities?options=upsert,flowControl',
|
|
495
496
|
utils.readExampleFile(
|
|
496
497
|
'./test/unit/ngsiv2/examples/' +
|
|
497
498
|
'contextRequests/createStaticAttributesProvisionDevice.json'
|
|
@@ -557,7 +558,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
557
558
|
.matchHeader('fiware-service', 'smartgondor')
|
|
558
559
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
559
560
|
.post(
|
|
560
|
-
'/v2/entities?options=upsert',
|
|
561
|
+
'/v2/entities?options=upsert,flowControl',
|
|
561
562
|
utils.readExampleFile(
|
|
562
563
|
'./test/unit/ngsiv2/examples/' +
|
|
563
564
|
'contextRequests/createStaticAttributesProvisionDevice.json'
|
|
@@ -631,7 +632,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
631
632
|
.matchHeader('fiware-service', 'smartgondor')
|
|
632
633
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
633
634
|
.post(
|
|
634
|
-
'/v2/entities?options=upsert',
|
|
635
|
+
'/v2/entities?options=upsert,flowControl',
|
|
635
636
|
utils.readExampleFile(
|
|
636
637
|
'./test/unit/ngsiv2/examples/' +
|
|
637
638
|
'contextRequests/createStaticAttributesProvisionDevice2.json'
|
|
@@ -700,7 +701,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
700
701
|
.matchHeader('fiware-service', 'smartgondor')
|
|
701
702
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
702
703
|
.post(
|
|
703
|
-
'/v2/entities?options=upsert',
|
|
704
|
+
'/v2/entities?options=upsert,flowControl',
|
|
704
705
|
utils.readExampleFile(
|
|
705
706
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice4.json'
|
|
706
707
|
)
|
|
@@ -772,7 +773,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
772
773
|
.matchHeader('fiware-service', 'smartgondor')
|
|
773
774
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
774
775
|
.post(
|
|
775
|
-
'/v2/entities?options=upsert',
|
|
776
|
+
'/v2/entities?options=upsert,flowControl',
|
|
776
777
|
utils.readExampleFile(
|
|
777
778
|
'./test/unit/ngsiv2/examples/' +
|
|
778
779
|
'contextRequests/createStaticAttributesProvisionDevice3.json'
|
|
@@ -977,7 +978,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
977
978
|
nock.cleanAll();
|
|
978
979
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
979
980
|
.post(
|
|
980
|
-
'/v2/entities?options=upsert',
|
|
981
|
+
'/v2/entities?options=upsert,flowControl',
|
|
981
982
|
utils.readExampleFile(
|
|
982
983
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
983
984
|
)
|
|
@@ -986,7 +987,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
986
987
|
|
|
987
988
|
contextBrokerMock
|
|
988
989
|
.post(
|
|
989
|
-
'/v2/entities?options=upsert',
|
|
990
|
+
'/v2/entities?options=upsert,flowControl',
|
|
990
991
|
utils.readExampleFile(
|
|
991
992
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
992
993
|
)
|
|
@@ -1137,7 +1138,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
1137
1138
|
contextBrokerMock
|
|
1138
1139
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1139
1140
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
1140
|
-
.post('/v2/entities?options=upsert')
|
|
1141
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
1141
1142
|
.reply(204);
|
|
1142
1143
|
|
|
1143
1144
|
done();
|
|
@@ -49,7 +49,8 @@ const iotAgentConfig = {
|
|
|
49
49
|
service: 'smartgondor',
|
|
50
50
|
subservice: 'gardens',
|
|
51
51
|
providerUrl: 'http://smartgondor.com',
|
|
52
|
-
explicitAttrs: false
|
|
52
|
+
explicitAttrs: false,
|
|
53
|
+
useCBflowControl: true
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
@@ -74,7 +75,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
74
75
|
contextBrokerMock
|
|
75
76
|
.matchHeader('fiware-service', 'smartgondor')
|
|
76
77
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
77
|
-
.post('/v2/entities?options=upsert')
|
|
78
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
78
79
|
.reply(204);
|
|
79
80
|
|
|
80
81
|
iotAgentLib.clearAll(done);
|
|
@@ -420,7 +421,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
420
421
|
.matchHeader('fiware-service', 'smartgondor')
|
|
421
422
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
422
423
|
.post(
|
|
423
|
-
'/v2/entities?options=upsert',
|
|
424
|
+
'/v2/entities?options=upsert,flowControl',
|
|
424
425
|
utils.readExampleFile(
|
|
425
426
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
426
427
|
)
|
|
@@ -492,7 +493,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
492
493
|
.matchHeader('fiware-service', 'smartgondor')
|
|
493
494
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
494
495
|
.post(
|
|
495
|
-
'/v2/entities?options=upsert',
|
|
496
|
+
'/v2/entities?options=upsert,flowControl',
|
|
496
497
|
utils.readExampleFile(
|
|
497
498
|
'./test/unit/ngsiv2/examples/' +
|
|
498
499
|
'contextRequests/createStaticAttributesProvisionDevice.json'
|
|
@@ -558,7 +559,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
558
559
|
.matchHeader('fiware-service', 'smartgondor')
|
|
559
560
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
560
561
|
.post(
|
|
561
|
-
'/v2/entities?options=upsert',
|
|
562
|
+
'/v2/entities?options=upsert,flowControl',
|
|
562
563
|
utils.readExampleFile(
|
|
563
564
|
'./test/unit/ngsiv2/examples/' +
|
|
564
565
|
'contextRequests/createStaticAttributesProvisionDevice.json'
|
|
@@ -632,7 +633,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
632
633
|
.matchHeader('fiware-service', 'smartgondor')
|
|
633
634
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
634
635
|
.post(
|
|
635
|
-
'/v2/entities?options=upsert',
|
|
636
|
+
'/v2/entities?options=upsert,flowControl',
|
|
636
637
|
utils.readExampleFile(
|
|
637
638
|
'./test/unit/ngsiv2/examples/' +
|
|
638
639
|
'contextRequests/createStaticAttributesProvisionDevice2.json'
|
|
@@ -706,7 +707,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
706
707
|
.matchHeader('fiware-service', 'smartgondor')
|
|
707
708
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
708
709
|
.post(
|
|
709
|
-
'/v2/entities?options=upsert',
|
|
710
|
+
'/v2/entities?options=upsert,flowControl',
|
|
710
711
|
utils.readExampleFile(
|
|
711
712
|
'./test/unit/ngsiv2/examples/' +
|
|
712
713
|
'contextRequests/createStaticAttributesProvisionDevice3.json'
|
|
@@ -914,7 +915,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
914
915
|
nock.cleanAll();
|
|
915
916
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
916
917
|
.post(
|
|
917
|
-
'/v2/entities?options=upsert',
|
|
918
|
+
'/v2/entities?options=upsert,flowControl',
|
|
918
919
|
utils.readExampleFile(
|
|
919
920
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
920
921
|
)
|
|
@@ -923,7 +924,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
923
924
|
|
|
924
925
|
contextBrokerMock
|
|
925
926
|
.post(
|
|
926
|
-
'/v2/entities?options=upsert',
|
|
927
|
+
'/v2/entities?options=upsert,flowControl',
|
|
927
928
|
utils.readExampleFile(
|
|
928
929
|
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
929
930
|
)
|
|
@@ -1074,7 +1075,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
1074
1075
|
contextBrokerMock
|
|
1075
1076
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1076
1077
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
1077
|
-
.post('/v2/entities?options=upsert')
|
|
1078
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
1078
1079
|
.reply(204);
|
|
1079
1080
|
|
|
1080
1081
|
done();
|
|
@@ -76,7 +76,8 @@ const iotAgentConfig = {
|
|
|
76
76
|
},
|
|
77
77
|
service: 'smartgondor',
|
|
78
78
|
subservice: 'gardens',
|
|
79
|
-
providerUrl: 'http://smartgondor.com'
|
|
79
|
+
providerUrl: 'http://smartgondor.com',
|
|
80
|
+
useCBflowControl: true
|
|
80
81
|
};
|
|
81
82
|
const device1 = {
|
|
82
83
|
id: 'light1',
|
|
@@ -215,7 +216,7 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
215
216
|
contextBrokerMock
|
|
216
217
|
.matchHeader('fiware-service', 'smartgondor')
|
|
217
218
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
218
|
-
.post('/v2/entities?options=upsert')
|
|
219
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
219
220
|
.reply(204);
|
|
220
221
|
|
|
221
222
|
iotAgentLib.activate(iotAgentConfig, function (error) {
|
|
@@ -321,7 +322,7 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
321
322
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
322
323
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
323
324
|
// provisioning folder
|
|
324
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
325
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').reply(204);
|
|
325
326
|
|
|
326
327
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
327
328
|
.post('/v2/registrations')
|
|
@@ -330,7 +331,7 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
330
331
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
331
332
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
332
333
|
// provisioning folder
|
|
333
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
334
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').reply(204);
|
|
334
335
|
|
|
335
336
|
contextBrokerMock.delete('/v2/registrations/6319a7f5254b05844116584d', '').reply(500);
|
|
336
337
|
|
|
@@ -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: List provisioned devices', function () {
|
|
@@ -96,7 +97,7 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
|
|
|
96
97
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
97
98
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
98
99
|
// provisioning folder
|
|
99
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
100
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').reply(204);
|
|
100
101
|
|
|
101
102
|
contextBrokerMock
|
|
102
103
|
.post('/v2/registrations')
|
|
@@ -105,7 +106,7 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
|
|
|
105
106
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
106
107
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
107
108
|
// provisioning folder
|
|
108
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
109
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').reply(204);
|
|
109
110
|
|
|
110
111
|
contextBrokerMock
|
|
111
112
|
.post('/v2/registrations')
|
|
@@ -114,7 +115,7 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
|
|
|
114
115
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
115
116
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
116
117
|
// provisioning folder
|
|
117
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
118
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').reply(204);
|
|
118
119
|
|
|
119
120
|
async.series(
|
|
120
121
|
[
|
|
@@ -308,7 +309,7 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
|
|
|
308
309
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
309
310
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
310
311
|
// provisioning folder
|
|
311
|
-
contextBrokerMock.post('/v2/entities?options=upsert').times(10).reply(204);
|
|
312
|
+
contextBrokerMock.post('/v2/entities?options=upsert,flowControl').times(10).reply(204);
|
|
312
313
|
|
|
313
314
|
iotAgentLib.clearAll(function () {
|
|
314
315
|
async.times(10, createDeviceRequest, function (error, results) {
|
|
@@ -84,7 +84,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
84
84
|
.matchHeader('fiware-service', 'smartgondor')
|
|
85
85
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
86
86
|
.post(
|
|
87
|
-
'/v2/entities?options=upsert',
|
|
87
|
+
'/v2/entities?options=upsert,flowControl',
|
|
88
88
|
utils.readExampleFile(
|
|
89
89
|
'./test/unit/ngsiv2/examples/contextRequests/createProvisionedDeviceMultientity.json'
|
|
90
90
|
)
|
|
@@ -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: Remove provisioned devices', function () {
|
|
@@ -97,7 +98,7 @@ describe('NGSI-v2 - Device provisioning API: Remove provisioned devices', functi
|
|
|
97
98
|
contextBrokerMock
|
|
98
99
|
.matchHeader('fiware-service', 'smartgondor')
|
|
99
100
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
100
|
-
.post('/v2/entities?options=upsert')
|
|
101
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
101
102
|
.reply(204);
|
|
102
103
|
|
|
103
104
|
const nockBody2 = utils.readExampleFile(
|
|
@@ -115,7 +116,7 @@ describe('NGSI-v2 - Device provisioning API: Remove provisioned devices', functi
|
|
|
115
116
|
contextBrokerMock
|
|
116
117
|
.matchHeader('fiware-service', 'smartgondor')
|
|
117
118
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
118
|
-
.post('/v2/entities?options=upsert')
|
|
119
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
119
120
|
.reply(204);
|
|
120
121
|
|
|
121
122
|
contextBrokerMock
|
|
@@ -130,7 +131,7 @@ describe('NGSI-v2 - Device provisioning API: Remove provisioned devices', functi
|
|
|
130
131
|
contextBrokerMock
|
|
131
132
|
.matchHeader('fiware-service', 'smartgondor')
|
|
132
133
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
133
|
-
.post('/v2/entities?options=upsert')
|
|
134
|
+
.post('/v2/entities?options=upsert,flowControl')
|
|
134
135
|
.reply(204);
|
|
135
136
|
|
|
136
137
|
async.series(
|