iotagent-node-lib 3.0.0 → 3.2.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 (122) hide show
  1. package/.github/workflows/ci.yml +1 -0
  2. package/config.js +5 -5
  3. package/doc/api.md +1540 -298
  4. package/doc/deprecated.md +3 -1
  5. package/doc/development.md +120 -0
  6. package/doc/installationguide.md +3 -6
  7. package/docker-compose-dev.yml +1 -1
  8. package/lib/commonConfig.js +7 -10
  9. package/lib/fiware-iotagent-lib.js +0 -10
  10. package/lib/jexlTranformsMap.js +2 -1
  11. package/lib/plugins/bidirectionalData.js +8 -26
  12. package/lib/plugins/expressionPlugin.js +8 -40
  13. package/lib/plugins/jexlParser.js +28 -0
  14. package/lib/services/commands/commandService.js +1 -1
  15. package/lib/services/devices/deviceService.js +2 -1
  16. package/lib/services/ngsi/entities-NGSI-LD.js +15 -73
  17. package/lib/services/ngsi/entities-NGSI-v2.js +149 -124
  18. package/lib/services/northBound/deviceProvisioningServer.js +17 -14
  19. package/lib/templates/createDevice.json +5 -2
  20. package/lib/templates/createDeviceLax.json +7 -5
  21. package/lib/templates/updateDevice.json +5 -2
  22. package/lib/templates/updateDeviceLax.json +3 -5
  23. package/package.json +2 -2
  24. package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +5 -5
  25. package/test/unit/examples/deviceProvisioningRequests/provisionMinimumDevice4.json +1 -0
  26. package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +4 -4
  27. package/test/unit/general/config-multi-core-test.js +2 -1
  28. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +2 -1
  29. package/test/unit/general/deviceService-test.js +2 -1
  30. package/test/unit/general/loglevel-api_test.js +2 -1
  31. package/test/unit/general/startup-test.js +2 -1
  32. package/test/unit/general/statistics-persistence_test.js +1 -0
  33. package/test/unit/general/statistics-service_test.js +1 -0
  34. package/test/unit/lazyAndCommands/commandRegistry_test.js +1 -0
  35. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +1 -0
  36. package/test/unit/mongodb/mongodb-connectionoptions-test.js +1 -0
  37. package/test/unit/mongodb/mongodb-group-registry-test.js +1 -0
  38. package/test/unit/mongodb/mongodb-registry-test.js +2 -1
  39. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +0 -2
  40. package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +2 -1
  41. package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +2 -1
  42. package/test/unit/ngsi-ld/general/deviceService-test.js +2 -1
  43. package/test/unit/ngsi-ld/general/https-support-test.js +2 -1
  44. package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +2 -1
  45. package/test/unit/ngsi-ld/general/startup-test.js +3 -2
  46. package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +2 -1
  47. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +5 -7
  48. package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +8 -6
  49. package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +18 -22
  50. package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +2 -1
  51. package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +2 -1
  52. package/test/unit/ngsi-ld/ngsiService/autocast-test.js +2 -1
  53. package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +2 -1
  54. package/test/unit/ngsi-ld/ngsiService/languageProperties-test.js +32 -34
  55. package/test/unit/ngsi-ld/ngsiService/staticAttributes-test.js +2 -1
  56. package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +2 -1
  57. package/test/unit/ngsi-ld/ngsiService/unsupported-endpoints-test.js +11 -15
  58. package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +2 -1
  59. package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +10 -9
  60. package/test/unit/ngsi-ld/plugins/compress-timestamp-plugin_test.js +2 -1
  61. package/test/unit/ngsi-ld/plugins/custom-plugin_test.js +152 -0
  62. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +3 -2
  63. package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +2 -1
  64. package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +1 -0
  65. package/test/unit/ngsi-ld/provisioning/device-registration_test.js +2 -1
  66. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +15 -12
  67. package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +1 -0
  68. package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +1 -0
  69. package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +1 -0
  70. package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +1 -0
  71. package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +1 -0
  72. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +13 -7
  73. package/test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice4.json +5 -1
  74. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +0 -8
  75. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +6 -0
  76. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +20 -0
  77. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin40.json +42 -0
  78. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +32 -0
  79. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +37 -0
  80. package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +7 -1
  81. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +7 -1
  82. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +7 -1
  83. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +232 -8
  84. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +2 -1
  85. package/test/unit/ngsiv2/general/deviceService-test.js +2 -1
  86. package/test/unit/ngsiv2/general/https-support-test.js +2 -1
  87. package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +2 -1
  88. package/test/unit/ngsiv2/general/startup-test.js +2 -1
  89. package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +2 -1
  90. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +2 -1
  91. package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +8 -6
  92. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +3 -3
  93. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +3 -2
  94. package/test/unit/ngsiv2/ngsiService/autocast-test.js +2 -1
  95. package/test/unit/ngsiv2/ngsiService/queryDeviceInformationInCb-test.js +2 -1
  96. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +2 -1
  97. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +2 -1
  98. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +2 -1
  99. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +8 -7
  100. package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +2 -1
  101. package/test/unit/ngsiv2/plugins/custom-plugin_test.js +151 -0
  102. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +87 -13
  103. package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -1
  104. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +1 -0
  105. package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +1 -0
  106. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +12 -3
  107. package/test/unit/ngsiv2/provisioning/device-registration_test.js +2 -1
  108. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +15 -12
  109. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +1 -0
  110. package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +1 -0
  111. package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +1 -0
  112. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +1 -0
  113. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +1 -0
  114. package/test/unit/plugins/capture-configuration-inPlugins_test.js +2 -1
  115. package/test/unit/plugins/capture-provision-inPlugins_test.js +2 -1
  116. package/doc/advanced-topics.md +0 -626
  117. package/doc/expressionLanguage.md +0 -762
  118. package/lib/plugins/expressionParser.js +0 -205
  119. package/test/unit/expressions/expression-test.js +0 -197
  120. package/test/unit/ngsi-ld/expressions/expressionBasedTransformations-test.js +0 -881
  121. package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +0 -950
  122. package/test/unit/ngsiv2/expressions/expressionCombinedTransformations-test.js +0 -294
@@ -0,0 +1,151 @@
1
+ /*
2
+ * Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
3
+ *
4
+ * This file is part of fiware-iotagent-lib
5
+ *
6
+ * fiware-iotagent-lib is free software: you can redistribute it and/or
7
+ * modify it under the terms of the GNU Affero General Public License as
8
+ * published by the Free Software Foundation, either version 3 of the License,
9
+ * or (at your option) any later version.
10
+ *
11
+ * fiware-iotagent-lib is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
+ * See the GNU Affero General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Affero General Public
17
+ * License along with fiware-iotagent-lib.
18
+ * If not, see http://www.gnu.org/licenses/.
19
+ *
20
+ * For those usages not covered by the GNU Affero General Public License
21
+ * please contact with::daniel.moranjimenez@telefonica.com
22
+ *
23
+ * Modified by: Daniel Calvo - ATOS Research & Innovation
24
+ */
25
+
26
+ const iotAgentLib = require('../../../../lib/fiware-iotagent-lib');
27
+ const should = require('should');
28
+ const logger = require('logops');
29
+ const nock = require('nock');
30
+ let contextBrokerMock;
31
+ const iotAgentConfig = {
32
+ contextBroker: {
33
+ host: '192.168.1.1',
34
+ port: '1026',
35
+ ngsiVersion: 'v2'
36
+ },
37
+ server: {
38
+ port: 4041
39
+ },
40
+ types: {
41
+ Light: {
42
+ commands: [],
43
+ type: 'Light',
44
+ lazy: [
45
+ {
46
+ name: 'temperature',
47
+ type: 'centigrades'
48
+ }
49
+ ],
50
+ active: [
51
+ {
52
+ name: 'pressure',
53
+ type: 'Hgmm'
54
+ }
55
+ ]
56
+ }
57
+ },
58
+ service: 'smartgondor',
59
+ subservice: 'gardens',
60
+ providerUrl: 'http://smartgondor.com'
61
+ };
62
+
63
+ describe('NGSI-v2 - Custom plugin', function () {
64
+ let updateInvoked = false;
65
+ let queryInvoked = false;
66
+
67
+ function updatePlugin(entity, typeInformation, callback) {
68
+ updateInvoked = true;
69
+ return callback(null, entity, typeInformation);
70
+ }
71
+ function queryPlugin(entity, typeInformation, callback) {
72
+ queryInvoked = true;
73
+ return callback(null, entity, typeInformation);
74
+ }
75
+ beforeEach(function (done) {
76
+ logger.setLevel('FATAL');
77
+
78
+ iotAgentLib.activate(iotAgentConfig, function () {
79
+ iotAgentLib.clearAll(function () {
80
+ iotAgentLib.addUpdateMiddleware(updatePlugin);
81
+ iotAgentLib.addQueryMiddleware(queryPlugin);
82
+ done();
83
+ });
84
+ });
85
+ });
86
+
87
+ afterEach(function (done) {
88
+ iotAgentLib.clearAll(function () {
89
+ iotAgentLib.deactivate(done);
90
+ updateInvoked = false;
91
+ queryInvoked = false;
92
+ });
93
+ });
94
+ describe('When an update occurs', function () {
95
+ const values = [
96
+ {
97
+ name: 'state',
98
+ type: 'Boolean',
99
+ value: 'true'
100
+ },
101
+ {
102
+ name: 'dimming',
103
+ type: 'Number',
104
+ value: 23
105
+ }
106
+ ];
107
+
108
+ beforeEach(function () {
109
+ nock.cleanAll();
110
+
111
+ contextBrokerMock = nock('http://192.168.1.1:1026')
112
+ .matchHeader('fiware-service', 'smartgondor')
113
+ .matchHeader('fiware-servicepath', 'gardens')
114
+ .patch('/v2/entities/light1/attrs')
115
+ .query({ type: 'Light' })
116
+ .reply(204);
117
+ });
118
+
119
+ it('should invoke the plugin', function (done) {
120
+ iotAgentLib.update('light1', 'Light', '', values, function (error) {
121
+ should.not.exist(error);
122
+ contextBrokerMock.done();
123
+ updateInvoked.should.equal(true);
124
+ done();
125
+ });
126
+ });
127
+ });
128
+ describe('When an query occurs', function () {
129
+ beforeEach(function () {
130
+ nock.cleanAll();
131
+
132
+ contextBrokerMock = nock('http://192.168.1.1:1026')
133
+ .matchHeader('fiware-service', 'smartgondor')
134
+ .matchHeader('fiware-servicepath', 'gardens')
135
+ .get('/v2/entities/light1/attrs')
136
+ .query({ type: 'Light', attrs: 'state,dimming' })
137
+ .reply(200, { state: 'good', dimming: '23' });
138
+ });
139
+
140
+ it('should invoke the plugin', function (done) {
141
+ const attributes = ['state', 'dimming'];
142
+ iotAgentLib.query('light1', 'Light', '', attributes, function (error) {
143
+ should.not.exist(error);
144
+ contextBrokerMock.done();
145
+ should.not.exist(error);
146
+ queryInvoked.should.equal(true);
147
+ done();
148
+ });
149
+ });
150
+ });
151
+ });
@@ -41,7 +41,8 @@ const iotAgentConfig = {
41
41
  ngsiVersion: 'v2'
42
42
  },
43
43
  server: {
44
- port: 4041
44
+ port: 4041,
45
+ host: 'localhost'
45
46
  },
46
47
  types: {
47
48
  WeatherStation: {
@@ -101,7 +102,7 @@ const iotAgentConfig = {
101
102
  object_id: 'h',
102
103
  name: 'humidity',
103
104
  type: 'Percentage',
104
- entity_name: 'Station Number ${@sn * 10}'
105
+ entity_name: '"Station Number "+sn*10'
105
106
  }
106
107
  ]
107
108
  },
@@ -114,13 +115,13 @@ const iotAgentConfig = {
114
115
  object_id: 'p',
115
116
  name: 'pressure',
116
117
  type: 'Hgmm',
117
- entity_name: 'Station Number ${@sn * 10}'
118
+ entity_name: '"Station Number "+sn*10'
118
119
  },
119
120
  {
120
121
  object_id: 'h',
121
122
  name: 'humidity',
122
123
  type: 'Percentage',
123
- entity_name: 'Station Number ${@sn * 10}'
124
+ entity_name: '"Station Number "+sn*10'
124
125
  }
125
126
  ]
126
127
  },
@@ -196,21 +197,21 @@ const iotAgentConfig = {
196
197
  {
197
198
  object_id: 'v1',
198
199
  name: 'vol',
199
- expression: '${@v1*100}',
200
+ expression: 'v1*100',
200
201
  type: 'Number',
201
202
  entity_name: 'WeatherStation1'
202
203
  },
203
204
  {
204
205
  object_id: 'v2',
205
206
  name: 'vol',
206
- expression: '${@v2*100}',
207
+ expression: 'v2*100',
207
208
  type: 'Number',
208
209
  entity_name: 'WeatherStation2'
209
210
  },
210
211
  {
211
212
  object_id: 'v',
212
213
  name: 'vol',
213
- expression: '${@v*100}',
214
+ expression: 'v*100',
214
215
  type: 'Number'
215
216
  }
216
217
  ]
@@ -243,7 +244,6 @@ const iotAgentConfig = {
243
244
  WeatherStation8Jexl: {
244
245
  commands: [],
245
246
  type: 'WeatherStation',
246
- expressionLanguage: 'jexl',
247
247
  lazy: [],
248
248
  active: [
249
249
  {
@@ -271,7 +271,6 @@ const iotAgentConfig = {
271
271
  WeatherStation9Jexl: {
272
272
  commands: [],
273
273
  type: 'WeatherStation',
274
- expressionLanguage: 'jexl',
275
274
  lazy: [],
276
275
  static: [
277
276
  {
@@ -363,7 +362,6 @@ const iotAgentConfig = {
363
362
  WrongStation: {
364
363
  commands: [],
365
364
  type: 'WrongStation',
366
- expressionLanguage: 'jexl',
367
365
  lazy: [],
368
366
  active: [
369
367
  {
@@ -455,7 +453,6 @@ const iotAgentConfig = {
455
453
  SharedIds3: {
456
454
  commands: [],
457
455
  type: 'ShareStation',
458
- expressionLanguage: 'jexl',
459
456
  lazy: [],
460
457
  active: [
461
458
  {
@@ -509,6 +506,42 @@ const iotAgentConfig = {
509
506
  ],
510
507
  explicitAttrs: true
511
508
  },
509
+ GPS1: {
510
+ commands: [],
511
+ expressionLanguage: 'jexl',
512
+ type: 'GPS',
513
+ lazy: [],
514
+ active: [
515
+ {
516
+ name: 'explicit',
517
+ type: 'number',
518
+ object_id: 'z'
519
+ },
520
+ {
521
+ name: 'expectedAtt',
522
+ type: 'number',
523
+ expression: 'z+1'
524
+ },
525
+ {
526
+ name: 'nonexpectedAtt',
527
+ type: 'number',
528
+ expression: 'w+1'
529
+ },
530
+ {
531
+ name: 'explicit',
532
+ type: 'number',
533
+ entity_name: 'SO5',
534
+ object_id: 'x'
535
+ },
536
+ {
537
+ name: 'explicit',
538
+ type: 'number',
539
+ entity_name: 'SO6',
540
+ object_id: 'y'
541
+ }
542
+ ],
543
+ explicitAttrs: true
544
+ },
512
545
  GPS2: {
513
546
  commands: [],
514
547
  type: 'GPS',
@@ -558,8 +591,7 @@ const iotAgentConfig = {
558
591
  name: 'pressure',
559
592
  type: 'Number'
560
593
  }
561
- ],
562
- expressionLanguage: 'jexl'
594
+ ]
563
595
  }
564
596
  },
565
597
  service: 'smartgondor',
@@ -1243,6 +1275,48 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
1243
1275
  });
1244
1276
  });
1245
1277
 
1278
+ describe('When an update comes for a multientity measurement explicitAttrs for several entities', function () {
1279
+ const values = [
1280
+ {
1281
+ name: 'x',
1282
+ type: 'Number',
1283
+ value: 52
1284
+ },
1285
+ {
1286
+ name: 'y',
1287
+ type: 'Number',
1288
+ value: 13
1289
+ },
1290
+ {
1291
+ name: 'z',
1292
+ type: 'Number',
1293
+ value: 12
1294
+ }
1295
+ ];
1296
+
1297
+ beforeEach(function () {
1298
+ nock.cleanAll();
1299
+ contextBrokerMock = nock('http://192.168.1.1:1026')
1300
+ .matchHeader('fiware-service', 'smartgondor')
1301
+ .matchHeader('fiware-servicepath', 'gardens')
1302
+ .post(
1303
+ '/v2/op/update',
1304
+ utils.readExampleFile(
1305
+ './test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json'
1306
+ )
1307
+ )
1308
+ .reply(204);
1309
+ });
1310
+
1311
+ it('should remove hidden attrs from the value', function (done) {
1312
+ iotAgentLib.update('gps1', 'GPS1', '', values, function (error) {
1313
+ should.not.exist(error);
1314
+ contextBrokerMock.done();
1315
+ done();
1316
+ });
1317
+ });
1318
+ });
1319
+
1246
1320
  describe('When an update comes for a multientity measurement explicitAttrs as jexl for one entity', function () {
1247
1321
  const values = [
1248
1322
  {
@@ -36,7 +36,8 @@ const iotAgentConfig = {
36
36
  ngsiVersion: 'v2'
37
37
  },
38
38
  server: {
39
- port: 4041
39
+ port: 4041,
40
+ host: 'localhost'
40
41
  },
41
42
  types: {
42
43
  Light: {
@@ -41,6 +41,7 @@ const iotAgentConfig = {
41
41
  server: {
42
42
  name: 'testAgent',
43
43
  port: 4041,
44
+ host: 'localhost',
44
45
  baseRoot: '/'
45
46
  },
46
47
  types: {},
@@ -56,6 +56,7 @@ const iotAgentConfig = {
56
56
  },
57
57
  server: {
58
58
  port: 4041,
59
+ host: 'localhost',
59
60
  baseRoot: '/'
60
61
  },
61
62
  types: {
@@ -42,6 +42,7 @@ const iotAgentConfig = {
42
42
  },
43
43
  server: {
44
44
  port: 4041,
45
+ host: 'localhost',
45
46
  baseRoot: '/'
46
47
  },
47
48
  types: {},
@@ -725,8 +726,16 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
725
726
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
726
727
  /*jshint camelcase: false */
727
728
  entity_type: 'MicroLights',
728
- entityNameExp: 'EntityNameByExp',
729
- cbHost: 'http://192.168.1.1:1026'
729
+ entityNameExp: "id + '__' + suffix_st",
730
+ expressionLanguage: 'jexl',
731
+ cbHost: 'http://192.168.1.1:1026',
732
+ static_attributes: [
733
+ {
734
+ name: 'suffix_st',
735
+ type: 'Text',
736
+ value: 'SUFFIX'
737
+ }
738
+ ]
730
739
  }
731
740
  ]
732
741
  },
@@ -757,7 +766,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
757
766
  request(options, function (error, response, body) {
758
767
  iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
759
768
  should.exist(results.devices[0].name);
760
- results.devices[0].name.should.equal('EntityNameByExp');
769
+ results.devices[0].name.should.equal('MicroLight1__SUFFIX');
761
770
  done();
762
771
  });
763
772
  });
@@ -40,7 +40,8 @@ const iotAgentConfig = {
40
40
  ngsiVersion: 'v2'
41
41
  },
42
42
  server: {
43
- port: 4041
43
+ port: 4041,
44
+ host: 'localhost'
44
45
  },
45
46
  types: {
46
47
  Light: {
@@ -39,7 +39,8 @@ const iotAgentConfig = {
39
39
  ngsiVersion: 'v2'
40
40
  },
41
41
  server: {
42
- port: 4041
42
+ port: 4041,
43
+ host: 'localhost'
43
44
  },
44
45
  types: {
45
46
  Light: {
@@ -268,17 +269,19 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
268
269
  });
269
270
  it('should store the new values in the registry', function (done) {
270
271
  iotAgentLib.updateRegister(deviceCommandUpdated, false, function (error, data) {
271
- iotAgentLib.getDevice(deviceCommandUpdated.id, 'smartgondor', 'gardens', function (
272
- error,
273
- deviceResult
274
- ) {
275
- should.not.exist(error);
276
- should.exist(deviceResult);
277
- deviceResult.internalId.should.equal(deviceUpdated.internalId);
278
- deviceResult.commands[0].name.should.equal('move');
279
- deviceResult.active[0].name.should.equal('temperature');
280
- done();
281
- });
272
+ iotAgentLib.getDevice(
273
+ deviceCommandUpdated.id,
274
+ 'smartgondor',
275
+ 'gardens',
276
+ function (error, deviceResult) {
277
+ should.not.exist(error);
278
+ should.exist(deviceResult);
279
+ deviceResult.internalId.should.equal(deviceUpdated.internalId);
280
+ deviceResult.commands[0].name.should.equal('move');
281
+ deviceResult.active[0].name.should.equal('temperature');
282
+ done();
283
+ }
284
+ );
282
285
  });
283
286
  });
284
287
  });
@@ -42,6 +42,7 @@ const iotAgentConfig = {
42
42
  },
43
43
  server: {
44
44
  port: 4041,
45
+ host: 'localhost',
45
46
  baseRoot: '/'
46
47
  },
47
48
  types: {},
@@ -41,6 +41,7 @@ const iotAgentConfig = {
41
41
  },
42
42
  server: {
43
43
  port: 4041,
44
+ host: 'localhost',
44
45
  baseRoot: '/'
45
46
  },
46
47
  types: {},
@@ -42,6 +42,7 @@ const iotAgentConfig = {
42
42
  },
43
43
  server: {
44
44
  port: 4041,
45
+ host: 'localhost',
45
46
  baseRoot: '/'
46
47
  },
47
48
  types: {},
@@ -41,6 +41,7 @@ const iotAgentConfig = {
41
41
  },
42
42
  server: {
43
43
  port: 4041,
44
+ host: 'localhost',
44
45
  baseRoot: '/'
45
46
  },
46
47
  types: {},
@@ -42,6 +42,7 @@ const iotAgentConfig = {
42
42
  },
43
43
  server: {
44
44
  port: 4041,
45
+ host: 'localhost',
45
46
  baseRoot: '/'
46
47
  },
47
48
  types: {},
@@ -35,7 +35,8 @@ const iotAgentConfig = {
35
35
  port: '1026'
36
36
  },
37
37
  server: {
38
- port: 4041
38
+ port: 4041,
39
+ host: 'localhost'
39
40
  },
40
41
  types: {
41
42
  Light: {
@@ -37,7 +37,8 @@ const iotAgentConfig = {
37
37
  port: '1026'
38
38
  },
39
39
  server: {
40
- port: 4041
40
+ port: 4041,
41
+ host: 'localhost'
41
42
  },
42
43
  types: {
43
44
  Light: {