iotagent-node-lib 3.2.0 → 3.3.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/ISSUE_TEMPLATE/bug_report.yml +134 -0
- package/.github/ISSUE_TEMPLATE/config.yml +16 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +55 -0
- package/.github/advanced-issue-labeler.yml +30 -0
- package/.github/workflows/issue-labeler.yml +43 -0
- package/doc/api.md +23 -80
- package/doc/deprecated.md +4 -0
- package/doc/howto.md +58 -62
- package/doc/installationguide.md +0 -5
- package/doc/requirements.txt +1 -1
- package/docker/Mosquitto/Dockerfile +1 -1
- package/lib/model/Device.js +0 -1
- package/lib/model/Group.js +0 -1
- package/lib/model/dbConn.js +1 -7
- package/lib/plugins/jexlParser.js +1 -1
- package/lib/services/common/iotManagerService.js +0 -1
- package/lib/services/devices/deviceRegistryMongoDB.js +10 -10
- package/lib/services/devices/deviceService.js +14 -19
- package/lib/services/devices/devices-NGSI-v2.js +2 -5
- package/lib/services/ngsi/entities-NGSI-LD.js +3 -3
- package/lib/services/ngsi/entities-NGSI-v2.js +34 -11
- package/lib/services/northBound/deviceProvisioningServer.js +0 -3
- package/lib/templates/createDevice.json +0 -4
- package/lib/templates/createDeviceLax.json +0 -4
- package/lib/templates/deviceGroup.json +1 -5
- package/lib/templates/updateDevice.json +4 -0
- package/lib/templates/updateDeviceLax.json +11 -0
- package/package.json +1 -1
- package/scripts/legacy_expression_tool/README.md +262 -0
- package/scripts/legacy_expression_tool/legacy_expression_tool.py +423 -0
- package/scripts/legacy_expression_tool/requirements.txt +3 -0
- package/test/unit/examples/deviceProvisioningRequests/provisionMinimumDevice4.json +0 -1
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +3 -13
- package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +33 -37
- package/test/unit/ngsiv2/examples/contextRequests/updateContext.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext1.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext4.json +4 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContext5.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext6.json +10 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandError.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandFinish.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp1.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp2.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin40.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +1 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionSkip.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin17.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json +3 -1
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +133 -75
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +18 -51
- package/test/unit/ngsiv2/general/https-support-test.js +1 -5
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +4 -10
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +8 -24
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +143 -57
- package/test/unit/ngsiv2/ngsiService/autocast-test.js +14 -21
- package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +3 -5
- package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +1 -10
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +0 -63
- package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +4 -6
- package/test/unit/ngsiv2/plugins/custom-plugin_test.js +1 -2
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +3 -5
- package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -3
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +2 -3
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +5 -53
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +1 -7
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -9
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -7
- package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
|
@@ -95,15 +95,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
95
95
|
)
|
|
96
96
|
)
|
|
97
97
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
98
|
-
|
|
99
|
-
contextBrokerMock
|
|
100
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
101
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
102
|
-
.post(
|
|
103
|
-
'/v2/entities?options=upsert',
|
|
104
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
105
|
-
)
|
|
106
|
-
.reply(204);
|
|
107
98
|
});
|
|
108
99
|
|
|
109
100
|
it('should subscribe to the modification of the combined attribute with all the variables', function (done) {
|
|
@@ -137,15 +128,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
137
128
|
)
|
|
138
129
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
139
130
|
|
|
140
|
-
contextBrokerMock
|
|
141
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
142
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
143
|
-
.post(
|
|
144
|
-
'/v2/entities?options=upsert',
|
|
145
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
146
|
-
)
|
|
147
|
-
.reply(204);
|
|
148
|
-
|
|
149
131
|
contextBrokerMock
|
|
150
132
|
.matchHeader('fiware-service', 'smartgondor')
|
|
151
133
|
.matchHeader('fiware-servicepath', '/gardens')
|
|
@@ -189,15 +171,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
189
171
|
)
|
|
190
172
|
)
|
|
191
173
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
192
|
-
|
|
193
|
-
contextBrokerMock
|
|
194
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
195
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
196
|
-
.post(
|
|
197
|
-
'/v2/entities?options=upsert',
|
|
198
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
199
|
-
)
|
|
200
|
-
.reply(204);
|
|
201
174
|
});
|
|
202
175
|
|
|
203
176
|
afterEach(function () {
|
|
@@ -296,15 +269,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
296
269
|
)
|
|
297
270
|
)
|
|
298
271
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
299
|
-
|
|
300
|
-
contextBrokerMock
|
|
301
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
302
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
303
|
-
.post(
|
|
304
|
-
'/v2/entities?options=upsert',
|
|
305
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
306
|
-
)
|
|
307
|
-
.reply(204);
|
|
308
272
|
});
|
|
309
273
|
|
|
310
274
|
afterEach(function () {
|
|
@@ -415,15 +379,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
415
379
|
)
|
|
416
380
|
)
|
|
417
381
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
418
|
-
|
|
419
|
-
contextBrokerMock
|
|
420
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
421
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
422
|
-
.post(
|
|
423
|
-
'/v2/entities?options=upsert',
|
|
424
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
425
|
-
)
|
|
426
|
-
.reply(204);
|
|
427
382
|
});
|
|
428
383
|
it('should subscribe to the modification of the combined attribute with all the variables', function (done) {
|
|
429
384
|
request(provisionGroup, function (error, response, body) {
|
|
@@ -480,15 +435,6 @@ describe('NGSI-v2 - Bidirectional data plugin', function () {
|
|
|
480
435
|
)
|
|
481
436
|
)
|
|
482
437
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
483
|
-
|
|
484
|
-
contextBrokerMock
|
|
485
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
486
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
487
|
-
.post(
|
|
488
|
-
'/v2/entities?options=upsert',
|
|
489
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
490
|
-
)
|
|
491
|
-
.reply(204);
|
|
492
438
|
});
|
|
493
439
|
|
|
494
440
|
afterEach(function () {
|
|
@@ -577,15 +523,6 @@ describe('NGSI-v2 - Bidirectional data plugin and CB is defined using environmen
|
|
|
577
523
|
)
|
|
578
524
|
)
|
|
579
525
|
.reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' });
|
|
580
|
-
|
|
581
|
-
contextBrokerMock
|
|
582
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
583
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
584
|
-
.post(
|
|
585
|
-
'/v2/entities?options=upsert',
|
|
586
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json')
|
|
587
|
-
)
|
|
588
|
-
.reply(204);
|
|
589
526
|
});
|
|
590
527
|
|
|
591
528
|
it('should subscribe to the modification of the combined attribute with all the variables', function (done) {
|
|
@@ -153,13 +153,12 @@ describe('NGSI-v2 - Timestamp compression plugin', function () {
|
|
|
153
153
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
154
154
|
.matchHeader('fiware-service', 'smartgondor')
|
|
155
155
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
156
|
-
.
|
|
157
|
-
'/v2/entities
|
|
156
|
+
.post(
|
|
157
|
+
'/v2/entities?options=upsert',
|
|
158
158
|
utils.readExampleFile(
|
|
159
159
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp1.json'
|
|
160
160
|
)
|
|
161
161
|
)
|
|
162
|
-
.query({ type: 'Light' })
|
|
163
162
|
.reply(204);
|
|
164
163
|
});
|
|
165
164
|
|
|
@@ -198,13 +197,12 @@ describe('NGSI-v2 - Timestamp compression plugin', function () {
|
|
|
198
197
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
199
198
|
.matchHeader('fiware-service', 'smartgondor')
|
|
200
199
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
201
|
-
.
|
|
202
|
-
'/v2/entities
|
|
200
|
+
.post(
|
|
201
|
+
'/v2/entities?options=upsert',
|
|
203
202
|
utils.readExampleFile(
|
|
204
203
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp2.json'
|
|
205
204
|
)
|
|
206
205
|
)
|
|
207
|
-
.query({ type: 'Light' })
|
|
208
206
|
.reply(204);
|
|
209
207
|
});
|
|
210
208
|
|
|
@@ -111,8 +111,7 @@ describe('NGSI-v2 - Custom plugin', function () {
|
|
|
111
111
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
112
112
|
.matchHeader('fiware-service', 'smartgondor')
|
|
113
113
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
114
|
-
.
|
|
115
|
-
.query({ type: 'Light' })
|
|
114
|
+
.post('/v2/entities?options=upsert')
|
|
116
115
|
.reply(204);
|
|
117
116
|
});
|
|
118
117
|
|
|
@@ -508,7 +508,6 @@ const iotAgentConfig = {
|
|
|
508
508
|
},
|
|
509
509
|
GPS1: {
|
|
510
510
|
commands: [],
|
|
511
|
-
expressionLanguage: 'jexl',
|
|
512
511
|
type: 'GPS',
|
|
513
512
|
lazy: [],
|
|
514
513
|
active: [
|
|
@@ -601,7 +600,7 @@ const iotAgentConfig = {
|
|
|
601
600
|
|
|
602
601
|
describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
603
602
|
beforeEach(function (done) {
|
|
604
|
-
logger.setLevel('
|
|
603
|
+
logger.setLevel('DEBUG');
|
|
605
604
|
|
|
606
605
|
iotAgentLib.activate(iotAgentConfig, function () {
|
|
607
606
|
iotAgentLib.clearAll(function () {
|
|
@@ -1672,9 +1671,8 @@ describe('NGSI-v2 - Multi-entity plugin is executed for a command update for a r
|
|
|
1672
1671
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1673
1672
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1674
1673
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1675
|
-
.
|
|
1676
|
-
|
|
1677
|
-
'/v2/entities/sensorCommand/attrs?type=SensorCommand',
|
|
1674
|
+
.post(
|
|
1675
|
+
'/v2/entities?options=upsert',
|
|
1678
1676
|
utils.readExampleFile(
|
|
1679
1677
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json'
|
|
1680
1678
|
)
|
|
@@ -98,14 +98,13 @@ describe('NGSI-v2 - Timestamp processing plugin', function () {
|
|
|
98
98
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
99
99
|
.matchHeader('fiware-service', 'smartgondor')
|
|
100
100
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
101
|
-
.
|
|
102
|
-
'/v2/entities
|
|
101
|
+
.post(
|
|
102
|
+
'/v2/entities?options=upsert',
|
|
103
103
|
// this tests breaks jexlBasedTransformation-test with uses updateContextExpressionPlugin32 which do not includes Timestamp in metadata attributes
|
|
104
104
|
utils.readExampleFile(
|
|
105
105
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json'
|
|
106
106
|
)
|
|
107
107
|
)
|
|
108
|
-
.query({ type: 'Light' })
|
|
109
108
|
.reply(204);
|
|
110
109
|
});
|
|
111
110
|
|
|
@@ -906,11 +906,10 @@ describe('NGSI-v2 - Device Group Configuration API', function () {
|
|
|
906
906
|
contextBrokerMock = nock('http://unexistentHost:1026')
|
|
907
907
|
.matchHeader('fiware-service', 'testservice')
|
|
908
908
|
.matchHeader('fiware-servicepath', '/testingPath')
|
|
909
|
-
.
|
|
910
|
-
'/v2/entities
|
|
909
|
+
.post(
|
|
910
|
+
'/v2/entities?options=upsert',
|
|
911
911
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json')
|
|
912
912
|
)
|
|
913
|
-
.query({ type: 'SensorMachine' })
|
|
914
913
|
.reply(204, {});
|
|
915
914
|
async.series([async.apply(request, optionsCreation)], done);
|
|
916
915
|
});
|
|
@@ -100,15 +100,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
100
100
|
)
|
|
101
101
|
)
|
|
102
102
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
103
|
-
|
|
104
|
-
contextBrokerMock
|
|
105
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
106
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
107
|
-
.post(
|
|
108
|
-
'/v2/entities?options=upsert',
|
|
109
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createProvisionedDevice.json')
|
|
110
|
-
)
|
|
111
|
-
.reply(204);
|
|
112
103
|
});
|
|
113
104
|
|
|
114
105
|
const options = {
|
|
@@ -214,7 +205,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
214
205
|
});
|
|
215
206
|
});
|
|
216
207
|
|
|
217
|
-
it('should create the initial entity in the Context Broker', function (done) {
|
|
208
|
+
it('should not create the initial entity in the Context Broker', function (done) {
|
|
218
209
|
request(options, function (error, response, body) {
|
|
219
210
|
response.statusCode.should.equal(201);
|
|
220
211
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
@@ -248,15 +239,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
248
239
|
|
|
249
240
|
beforeEach(function (done) {
|
|
250
241
|
nock.cleanAll();
|
|
251
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
252
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
253
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
254
|
-
.post(
|
|
255
|
-
'/v2/entities?options=upsert',
|
|
256
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createTimeinstantDevice.json')
|
|
257
|
-
)
|
|
258
|
-
.reply(204);
|
|
259
|
-
|
|
260
242
|
done();
|
|
261
243
|
});
|
|
262
244
|
|
|
@@ -292,15 +274,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
292
274
|
|
|
293
275
|
beforeEach(function (done) {
|
|
294
276
|
nock.cleanAll();
|
|
295
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
296
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
297
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
298
|
-
.post(
|
|
299
|
-
'/v2/entities?options=upsert',
|
|
300
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createTimeinstantDevice.json')
|
|
301
|
-
)
|
|
302
|
-
.reply(204);
|
|
303
|
-
|
|
304
277
|
done();
|
|
305
278
|
});
|
|
306
279
|
|
|
@@ -336,15 +309,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
336
309
|
|
|
337
310
|
beforeEach(function (done) {
|
|
338
311
|
nock.cleanAll();
|
|
339
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
340
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
341
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
342
|
-
.post(
|
|
343
|
-
'/v2/entities?options=upsert',
|
|
344
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createExplicitAttrsDevice.json')
|
|
345
|
-
)
|
|
346
|
-
.reply(204);
|
|
347
|
-
|
|
348
312
|
done();
|
|
349
313
|
});
|
|
350
314
|
|
|
@@ -394,17 +358,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
394
358
|
|
|
395
359
|
beforeEach(function (done) {
|
|
396
360
|
nock.cleanAll();
|
|
397
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
398
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
399
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
400
|
-
.post(
|
|
401
|
-
'/v2/entities?options=upsert',
|
|
402
|
-
utils.readExampleFile(
|
|
403
|
-
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
404
|
-
)
|
|
405
|
-
)
|
|
406
|
-
.reply(204);
|
|
407
|
-
|
|
408
361
|
done();
|
|
409
362
|
});
|
|
410
363
|
|
|
@@ -552,12 +505,12 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
552
505
|
done();
|
|
553
506
|
});
|
|
554
507
|
|
|
555
|
-
it('should store the device with static attributes provided in configuration', function (done) {
|
|
508
|
+
it('should not store the device with static attributes provided in configuration', function (done) {
|
|
556
509
|
request(groupCreation, function (error, response, body) {
|
|
557
510
|
request(options, function (error, response, body) {
|
|
558
511
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
559
512
|
should.exist(results.devices[0].staticAttributes);
|
|
560
|
-
results.devices[0].staticAttributes
|
|
513
|
+
results.devices[0].staticAttributes.length.should.equal(0);
|
|
561
514
|
done();
|
|
562
515
|
});
|
|
563
516
|
});
|
|
@@ -692,12 +645,12 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
692
645
|
done();
|
|
693
646
|
});
|
|
694
647
|
|
|
695
|
-
it('should store the device with static attributes provided in
|
|
648
|
+
it('should store the device with static attributes provided in device but no in configuration', function (done) {
|
|
696
649
|
request(groupCreation, function (error, response, body) {
|
|
697
650
|
request(options, function (error, response, body) {
|
|
698
651
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
699
652
|
should.exist(results.devices[0].staticAttributes);
|
|
700
|
-
results.devices[0].staticAttributes.length.should.equal(
|
|
653
|
+
results.devices[0].staticAttributes.length.should.equal(1);
|
|
701
654
|
done();
|
|
702
655
|
});
|
|
703
656
|
});
|
|
@@ -727,7 +680,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
727
680
|
/*jshint camelcase: false */
|
|
728
681
|
entity_type: 'MicroLights',
|
|
729
682
|
entityNameExp: "id + '__' + suffix_st",
|
|
730
|
-
expressionLanguage: 'jexl',
|
|
731
683
|
cbHost: 'http://192.168.1.1:1026',
|
|
732
684
|
static_attributes: [
|
|
733
685
|
{
|
|
@@ -112,11 +112,7 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
112
112
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
113
113
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
114
114
|
// provisioning folder
|
|
115
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
116
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
117
|
-
.matchHeader('fiware-servicepath', 'gardens')
|
|
118
|
-
.post('/v2/entities?options=upsert')
|
|
119
|
-
.reply(204);
|
|
115
|
+
contextBrokerMock = nock('http://192.168.1.1:1026');
|
|
120
116
|
|
|
121
117
|
const nockBody = utils.readExampleFile(
|
|
122
118
|
'./test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent1.json'
|
|
@@ -279,7 +275,6 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
279
275
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
280
276
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
281
277
|
// provisioning folder
|
|
282
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
283
278
|
|
|
284
279
|
contextBrokerMock
|
|
285
280
|
.post('/v2/registrations')
|
|
@@ -288,7 +283,6 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
288
283
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
289
284
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
290
285
|
// provisioning folder
|
|
291
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
292
286
|
|
|
293
287
|
contextBrokerMock
|
|
294
288
|
.delete('/v2/registrations/6319a7f5254b05844116584d', '')
|
|
@@ -148,15 +148,6 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
148
148
|
.post('/v2/registrations')
|
|
149
149
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
150
150
|
|
|
151
|
-
// This mock does not check the payload since the aim of the test is not to verify
|
|
152
|
-
// device provisioning functionality. Appropriate verification is done in tests under
|
|
153
|
-
// provisioning folder
|
|
154
|
-
contextBrokerMock
|
|
155
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
156
|
-
.matchHeader('fiware-servicepath', 'gardens')
|
|
157
|
-
.post('/v2/entities?options=upsert')
|
|
158
|
-
.reply(204);
|
|
159
|
-
|
|
160
151
|
iotAgentLib.activate(iotAgentConfig, function (error) {
|
|
161
152
|
iotAgentLib.register(device1, function (error) {
|
|
162
153
|
done();
|
|
@@ -212,6 +203,7 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
212
203
|
done();
|
|
213
204
|
});
|
|
214
205
|
});
|
|
206
|
+
|
|
215
207
|
it('should store the new values in the registry', function (done) {
|
|
216
208
|
iotAgentLib.updateRegister(deviceUpdated, false, function (error, data) {
|
|
217
209
|
iotAgentLib.getDevice(deviceUpdated.id, 'smartgondor', 'gardens', function (error, deviceResult) {
|
|
@@ -267,6 +259,7 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
267
259
|
done();
|
|
268
260
|
});
|
|
269
261
|
});
|
|
262
|
+
|
|
270
263
|
it('should store the new values in the registry', function (done) {
|
|
271
264
|
iotAgentLib.updateRegister(deviceCommandUpdated, false, function (error, data) {
|
|
272
265
|
iotAgentLib.getDevice(
|
|
@@ -288,17 +288,6 @@ describe('NGSI-v2 - Provisioning API: Single service mode', function () {
|
|
|
288
288
|
)
|
|
289
289
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
290
290
|
|
|
291
|
-
contextBrokerMock
|
|
292
|
-
.matchHeader('fiware-service', 'testservice')
|
|
293
|
-
.matchHeader('fiware-servicepath', '/testingPath')
|
|
294
|
-
.post(
|
|
295
|
-
'/v2/entities?options=upsert',
|
|
296
|
-
utils.readExampleFile(
|
|
297
|
-
'./test/unit/ngsiv2/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json'
|
|
298
|
-
)
|
|
299
|
-
)
|
|
300
|
-
.reply(204);
|
|
301
|
-
|
|
302
291
|
request(groupCreation, done);
|
|
303
292
|
});
|
|
304
293
|
|
|
@@ -376,13 +376,6 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
|
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
378
|
});
|
|
379
|
-
it('should create the initial values for the attributes in the Context Broker', function (done) {
|
|
380
|
-
request(optionsUpdate, function (error, response, body) {
|
|
381
|
-
should.not.exist(error);
|
|
382
|
-
contextBrokerMock.done();
|
|
383
|
-
done();
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
379
|
});
|
|
387
380
|
|
|
388
381
|
describe('When a device is updated to add static attributes', function () {
|
|
@@ -89,12 +89,6 @@ describe('NGSI-v2 - Data Mapping Plugins: device provision', function () {
|
|
|
89
89
|
)
|
|
90
90
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
91
91
|
|
|
92
|
-
contextBrokerMock
|
|
93
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
94
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
95
|
-
.post('/v2/entities?options=upsert')
|
|
96
|
-
.reply(204);
|
|
97
|
-
|
|
98
92
|
iotAgentLib.activate(iotAgentConfig, function (error) {
|
|
99
93
|
iotAgentLib.clearAll(done);
|
|
100
94
|
});
|