iotagent-node-lib 4.7.0 → 4.9.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 (110) hide show
  1. package/.github/workflows/ci.yml +6 -3
  2. package/.nyc_output/e4b1fe20-197e-4221-9f8d-6db65ff234b2.json +1 -0
  3. package/.nyc_output/processinfo/e4b1fe20-197e-4221-9f8d-6db65ff234b2.json +1 -0
  4. package/.nyc_output/processinfo/index.json +1 -0
  5. package/CHANGES_NEXT_RELEASE +1 -0
  6. package/Changelog +793 -0
  7. package/doc/README.md +1 -0
  8. package/doc/admin.md +8 -4
  9. package/doc/api.md +8 -4
  10. package/doc/devel/northboundinteractions.md +122 -15
  11. package/doc/models/models.md +260 -0
  12. package/doc/requirements.txt +1 -1
  13. package/docker/Mosquitto/Dockerfile +1 -1
  14. package/lib/commonConfig.js +11 -2
  15. package/lib/fiware-iotagent-lib.js +15 -11
  16. package/lib/jexlTranformsMap.js +182 -35
  17. package/lib/model/Command.js +9 -0
  18. package/lib/model/Device.js +1 -0
  19. package/lib/services/commands/commandRegistryMongoDB.js +15 -1
  20. package/lib/services/commands/commandService.js +3 -3
  21. package/lib/services/common/domain.js +4 -3
  22. package/lib/services/devices/deviceRegistryMongoDB.js +1 -1
  23. package/lib/services/devices/deviceService.js +11 -2
  24. package/lib/services/devices/devices-NGSI-LD.js +1 -2
  25. package/lib/services/devices/devices-NGSI-v2.js +1 -2
  26. package/lib/services/ngsi/entities-NGSI-LD.js +69 -13
  27. package/lib/services/ngsi/ngsiService.js +3 -1
  28. package/lib/services/northBound/contextServer-NGSI-LD.js +5 -3
  29. package/lib/services/northBound/contextServer-NGSI-v2.js +12 -3
  30. package/lib/services/northBound/contextServer.js +2 -1
  31. package/lib/services/northBound/northboundServer.js +2 -1
  32. package/lib/services/northBound/restUtils.js +6 -2
  33. package/lib/templates/createDevice.json +4 -0
  34. package/lib/templates/updateDevice.json +4 -0
  35. package/package.json +1 -1
  36. package/test/functional/config-test.js +1 -1
  37. package/test/functional/testUtils.js +13 -2
  38. package/test/unit/expressions/jexlExpression-test.js +165 -1
  39. package/test/unit/ngsi-ld/examples/contextRequests/createDatetimeProvisionedDevice.json +1 -4
  40. package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDevice.json +3 -12
  41. package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceMultientity.json +3 -12
  42. package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json +6 -24
  43. package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic2.json +1 -4
  44. package/test/unit/ngsi-ld/examples/contextRequests/updateContext1.json +1 -4
  45. package/test/unit/ngsi-ld/examples/contextRequests/updateContext3WithStatic.json +1 -4
  46. package/test/unit/ngsi-ld/examples/contextRequests/updateContext4.json +1 -4
  47. package/test/unit/ngsi-ld/examples/contextRequests/updateContext5.json +1 -4
  48. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin6.json +1 -4
  49. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin7.json +1 -4
  50. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin8.json +4 -2
  51. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin9.json +1 -4
  52. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCommandError.json +3 -9
  53. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCommandExpired.json +13 -19
  54. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCommandFinish.json +13 -19
  55. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCommandStatus1.json +4 -9
  56. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCompressTimestamp1.json +1 -4
  57. package/test/unit/ngsi-ld/examples/contextRequests/updateContextCompressTimestamp2.json +1 -4
  58. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +1 -4
  59. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin2.json +2 -8
  60. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +1 -4
  61. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4.json +2 -8
  62. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4a.json +3 -12
  63. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin6.json +3 -5
  64. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin7.json +1 -4
  65. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin8a.json +1 -4
  66. package/test/unit/ngsi-ld/examples/contextRequests/updateContextJsonProperty.json +13 -0
  67. package/test/unit/ngsi-ld/examples/contextRequests/updateContextListProperty.json +14 -0
  68. package/test/unit/ngsi-ld/examples/contextRequests/updateContextListRelationship.json +14 -0
  69. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin1.json +2 -8
  70. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin2.json +2 -8
  71. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin3.json +3 -8
  72. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin4.json +1 -4
  73. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin5.json +2 -8
  74. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin8.json +2 -8
  75. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +2 -8
  76. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +1 -4
  77. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -4
  78. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -8
  79. package/test/unit/ngsi-ld/examples/contextRequests/updateContextRelationship.json +11 -0
  80. package/test/unit/ngsi-ld/examples/contextRequests/updateContextValueType1.json +51 -0
  81. package/test/unit/ngsi-ld/examples/contextRequests/updateContextValueType2.json +65 -0
  82. package/test/unit/ngsi-ld/examples/contextRequests/updateContextVocabProperty.json +11 -0
  83. package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionCommands1.json +2 -8
  84. package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionDeviceStatic.json +1 -4
  85. package/test/unit/ngsi-ld/general/startup-test.js +3 -0
  86. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +1 -1
  87. package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +71 -1
  88. package/test/unit/ngsi-ld/ngsiService/attributeTypes-test.js +293 -0
  89. package/test/unit/ngsi-ld/ngsiService/unsupported-endpoints-test.js +0 -10
  90. package/test/unit/ngsi-ld/ngsiService/value-types-test.js +221 -0
  91. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast1.json +0 -11
  92. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast10.json +0 -14
  93. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast2.json +0 -11
  94. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast3.json +0 -11
  95. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast4.json +0 -11
  96. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast5.json +0 -7
  97. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast6.json +0 -17
  98. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast7.json +0 -19
  99. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast8.json +0 -14
  100. package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast9.json +0 -14
  101. package/test/unit/ngsi-ld/ngsiService/languageProperties-test.js +0 -109
  102. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json +0 -8
  103. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json +0 -8
  104. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json +0 -8
  105. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json +0 -8
  106. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json +0 -8
  107. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json +0 -8
  108. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json +0 -8
  109. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +0 -326
  110. /package/test/unit/ngsi-ld/examples/contextRequests/{updateContextLanguageProperties1.json → updateContextLanguageProperty.json} +0 -0
@@ -30,7 +30,7 @@ const context = {
30
30
  op: 'IoTAgentNGSI.ContextServer'
31
31
  };
32
32
  const contextServerUtils = require('./contextServerUtils');
33
-
33
+ const executeUpdateSideEffects = contextServerUtils.executeUpdateSideEffects;
34
34
  let contextServerHandler;
35
35
 
36
36
  /**
@@ -157,4 +157,5 @@ exports.setCommandHandler = intoTrans(context, setCommandHandler);
157
157
  exports.setNotificationHandler = intoTrans(context, setNotificationHandler);
158
158
  exports.addNotificationMiddleware = intoTrans(context, addNotificationMiddleware);
159
159
  exports.setQueryHandler = intoTrans(context, setQueryHandler);
160
+ exports.executeUpdateSideEffects = intoTrans(context, executeUpdateSideEffects);
160
161
  exports.init = init;
@@ -59,7 +59,7 @@ function start(config, callback) {
59
59
  northboundServer.app.use(domainUtils.requestDomain);
60
60
  northboundServer.app.use(bodyParser.json({ limit: config.expressLimit }));
61
61
  northboundServer.app.use(bodyParser.json({ type: 'application/*+json', limit: config.expressLimit }));
62
-
62
+ northboundServer.app.set('trust proxy', true); // populate req.ip
63
63
  if (config.logLevel && config.logLevel === 'DEBUG') {
64
64
  northboundServer.app.use(middlewares.traceRequest);
65
65
  }
@@ -125,6 +125,7 @@ exports.setRemoveDeviceHandler = intoTrans(context, deviceProvisioning.setRemove
125
125
  exports.addDeviceProvisionMiddleware = deviceProvisioning.addDeviceProvisionMiddleware;
126
126
  exports.addConfigurationProvisionMiddleware = groupProvisioning.addConfigurationProvisionMiddleware;
127
127
  exports.addNotificationMiddleware = contextServer.addNotificationMiddleware;
128
+ exports.executeUpdateSideEffects = contextServer.executeUpdateSideEffects;
128
129
  exports.clear = clear;
129
130
  exports.start = intoTrans(context, start);
130
131
  exports.stop = intoTrans(context, stop);
@@ -30,7 +30,6 @@ const errors = require('../../errors');
30
30
  const constants = require('../../constants');
31
31
  const intoTrans = require('../common/domain').intoTrans;
32
32
  const revalidator = require('revalidator');
33
- const moment = require('moment');
34
33
  const context = {
35
34
  op: 'IoTAgentNGSI.RestUtils'
36
35
  };
@@ -121,6 +120,11 @@ function checkBody(template) {
121
120
  };
122
121
  }
123
122
 
123
+ function isISOString(val) {
124
+ const d = new Date(val);
125
+ return !Number.isNaN(d.valueOf()) && d.toISOString() === val;
126
+ }
127
+
124
128
  /**
125
129
  * Checks if the timestamp properties of NGSIv2 entities are valid ISO8601 dates.
126
130
  *
@@ -131,7 +135,7 @@ function IsValidTimestampedNgsi2(payload) {
131
135
  function isValidTimestampedNgsi2Entity(entity) {
132
136
  for (const i in entity) {
133
137
  if (entity.hasOwnProperty(i)) {
134
- if (i === constants.TIMESTAMP_ATTRIBUTE && !moment(entity[i].value, moment.ISO_8601).isValid()) {
138
+ if (i === constants.TIMESTAMP_ATTRIBUTE && !isISOString(entity[i].value)) {
135
139
  return false;
136
140
  }
137
141
  }
@@ -167,6 +167,10 @@
167
167
  "description": "Content type",
168
168
  "type": "string"
169
169
  },
170
+ "headers": {
171
+ "description": "Optional headers to include with command",
172
+ "type": "object"
173
+ },
170
174
  "mqtt": {
171
175
  "description": "Mqtt properties",
172
176
  "type": "object",
@@ -145,6 +145,10 @@
145
145
  "description": "Optional expression for command transformation",
146
146
  "type": "string"
147
147
  },
148
+ "headers": {
149
+ "description": "Optional headers to include with command",
150
+ "type": "object"
151
+ },
148
152
  "payloadType": {
149
153
  "description": "Payload type",
150
154
  "type": "string"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "iotagent-node-lib",
3
3
  "license": "AGPL-3.0-only",
4
4
  "description": "IoT Agent library to interface with NGSI Context Broker",
5
- "version": "4.7.0",
5
+ "version": "4.9.0",
6
6
  "homepage": "https://github.com/telefonicaid/iotagent-node-lib",
7
7
  "keywords": [
8
8
  "fiware",
@@ -45,7 +45,7 @@ config.amqp = {
45
45
  };
46
46
 
47
47
  config.iota = {
48
- logLevel: 'DEBUG',
48
+ logLevel: 'FATAL',
49
49
  contextBroker: {
50
50
  host: '192.168.1.1',
51
51
  port: '1026',
@@ -74,16 +74,27 @@ function sendMeasureIotaLib(measure, provision) {
74
74
  * This is not a problem for the tests using other transports than Lib, in that case, the type will be retrieved
75
75
  * from the real provision.
76
76
  */
77
+ let typeInformation = {
78
+ service: provision.headers['fiware-service'],
79
+ subservice: provision.headers['fiware-servicepath']
80
+ };
77
81
  let type;
82
+ let staticAttrs;
78
83
  if (Array.isArray(provision.json.services) && provision.json.services.length > 0) {
79
84
  type = provision.json.services[0].entity_type;
85
+ staticAttrs = provision.json.services[0].static_attributes;
80
86
  } else {
81
87
  type = DEF_TYPE;
82
88
  }
89
+ typeInformation.type = type;
90
+ if (staticAttrs) {
91
+ typeInformation.staticAttributes = staticAttrs;
92
+ }
93
+ typeInformation.id = measure.qs.i;
83
94
  iotAgentLib.update(
84
95
  type + ':' + measure.qs.i,
85
96
  type,
86
- '',
97
+ typeInformation,
87
98
  jsonToIotaMeasures(measure.json),
88
99
  function (error, result, body) {
89
100
  error ? reject(error) : resolve(result);
@@ -230,7 +241,7 @@ async function testCase(measure, expectation, provision, env, config, type, tran
230
241
  if (transport === 'MQTT') {
231
242
  try {
232
243
  let client = await MQTT.connectAsync('mqtt://' + config.mqtt.host);
233
- await client.publish('/' + measure.qs.k + '/' + measure.qs.i + '/attrs', JSON.stringify(measure.json));
244
+ await client.publish('/json/' + measure.qs.k + '/' + measure.qs.i + '/attrs', JSON.stringify(measure.json));
234
245
  await client.end();
235
246
  } catch (error) {
236
247
  expect.fail(ERR_MQTT + error);
@@ -40,7 +40,12 @@ describe('Jexl expression interpreter', function () {
40
40
  object: {
41
41
  name: 'John',
42
42
  surname: 'Doe'
43
- }
43
+ },
44
+ invalidJson: '{"name": "John", surname": "Doe"}', // Invalid JSON for jsonparse
45
+ invalidDate: 'invalid-date', // Invalid date for toisodate and other date functions
46
+ emptyArray: [], // Empty array for addreduce
47
+ invalidHex: 'zz', // Invalid hex string for hextostring
48
+ nonNumeric: 'not-a-number' // Non-numeric input for parseint, parsefloat
44
49
  };
45
50
 
46
51
  describe('When a expression with a single value is parsed', function () {
@@ -392,4 +397,163 @@ describe('Jexl expression interpreter', function () {
392
397
  });
393
398
  });
394
399
  });
400
+
401
+ // Check errors
402
+ describe('When invalid inputs are used', function () {
403
+ describe('When an invalid JSON string is parsed', function () {
404
+ it('should return null for jsonparse', function (done) {
405
+ expressionParser.parse('invalidJson|jsonparse', scope, function (error, result) {
406
+ should.not.exist(error);
407
+ should(result).be.Null();
408
+ done();
409
+ });
410
+ });
411
+ });
412
+
413
+ describe('When an invalid date string is parsed', function () {
414
+ it('should return null for toisodate', function (done) {
415
+ expressionParser.parse('invalidDate|toisodate', scope, function (error, result) {
416
+ should.not.exist(error);
417
+ should(result).be.Null();
418
+ done();
419
+ });
420
+ });
421
+
422
+ it('should return null for timeoffset', function (done) {
423
+ expressionParser.parse('invalidDate|timeoffset', scope, function (error, result) {
424
+ should.not.exist(error);
425
+ should(result).be.Null();
426
+ done();
427
+ });
428
+ });
429
+ });
430
+
431
+ describe('When an empty array is processed with addreduce', function () {
432
+ it('should return null for addreduce', function (done) {
433
+ expressionParser.parse('emptyArray|addreduce', scope, function (error, result) {
434
+ should.not.exist(error);
435
+ should(result).be.Null();
436
+ done();
437
+ });
438
+ });
439
+ });
440
+
441
+ describe('When a non-numeric string is parsed by parseint and parsefloat', function () {
442
+ it('should return null for parseint', function (done) {
443
+ expressionParser.parse('nonNumeric|parseint', scope, function (error, result) {
444
+ should.not.exist(error);
445
+ should(result).be.Null();
446
+ done();
447
+ });
448
+ });
449
+
450
+ it('should return null for parsefloat', function (done) {
451
+ expressionParser.parse('nonNumeric|parsefloat', scope, function (error, result) {
452
+ should.not.exist(error);
453
+ should(result).be.Null();
454
+ done();
455
+ });
456
+ });
457
+ });
458
+
459
+ describe('When an invalid hex string is processed by hextostring', function () {
460
+ it('should return null for hextostring', function (done) {
461
+ expressionParser.parse('invalidHex|hextostring', scope, function (error, result) {
462
+ should.not.exist(error);
463
+ should(result).be.Null();
464
+ done();
465
+ });
466
+ });
467
+ });
468
+
469
+ describe('When invalid regular expressions are used in replace functions', function () {
470
+ it('should return null for replaceregexp with invalid regex', function (done) {
471
+ expressionParser.parse(
472
+ 'theString|replaceregexp("[a-z", "replacement")',
473
+ scope,
474
+ function (error, result) {
475
+ should.not.exist(error);
476
+ should(result).be.Null();
477
+ done();
478
+ }
479
+ );
480
+ });
481
+
482
+ it('should return null for replaceallregexp with invalid regex', function (done) {
483
+ expressionParser.parse(
484
+ 'theString|replaceallregexp("[a-z", "replacement")',
485
+ scope,
486
+ function (error, result) {
487
+ should.not.exist(error);
488
+ should(result).be.Null();
489
+ done();
490
+ }
491
+ );
492
+ });
493
+ });
494
+
495
+ describe('When tostring is used with null or undefined', function () {
496
+ it('should return null for tostring(null)', function (done) {
497
+ expressionParser.parse('null|tostring', scope, function (error, result) {
498
+ should.not.exist(error);
499
+ should(result).be.Null();
500
+ done();
501
+ });
502
+ });
503
+
504
+ it('should return null for tostring(undefined)', function (done) {
505
+ expressionParser.parse('undefined|tostring', scope, function (error, result) {
506
+ should.not.exist(error);
507
+ should(result).be.Null();
508
+ done();
509
+ });
510
+ });
511
+ });
512
+
513
+ describe('When urldecode is used with an invalid URI', function () {
514
+ it('should return null for urldecode with malformed URI', function (done) {
515
+ expressionParser.parse('"%%%invalidURI"|urldecode', scope, function (error, result) {
516
+ should.not.exist(error);
517
+ should(result).be.Null();
518
+ done();
519
+ });
520
+ });
521
+ });
522
+
523
+ describe('When tofixed is used with invalid inputs', function () {
524
+ it('should return null for tofixed with non-numeric value', function (done) {
525
+ expressionParser.parse('"notANumber"|tofixed(2)', scope, function (error, result) {
526
+ should.not.exist(error);
527
+ should(result).be.Null();
528
+ done();
529
+ });
530
+ });
531
+
532
+ it('should return null for tofixed with invalid decimal value', function (done) {
533
+ expressionParser.parse('"123.456"|tofixed("invalid")', scope, function (error, result) {
534
+ should.not.exist(error);
535
+ should(result).be.Null();
536
+ done();
537
+ });
538
+ });
539
+ });
540
+
541
+ describe('When gettime is used with invalid date', function () {
542
+ it('should return null for gettime with invalid date string', function (done) {
543
+ expressionParser.parse('"invalidDate"|gettime', scope, function (error, result) {
544
+ should.not.exist(error);
545
+ should(result).be.Null();
546
+ done();
547
+ });
548
+ });
549
+
550
+ it('should return null for gettime with null', function (done) {
551
+ expressionParser.parse('null|gettime', scope, function (error, result) {
552
+ should.not.exist(error);
553
+ should(result).be.Null();
554
+ done();
555
+ });
556
+ });
557
+ });
558
+ });
395
559
  });
@@ -4,10 +4,7 @@
4
4
  "id": "urn:ngsi-ld:MicroLights:FirstMicroLight",
5
5
  "timestamp": {
6
6
  "type": "Property",
7
- "value": {
8
- "@type": "DateTime",
9
- "@value": "1970-01-01T00:00:00.000Z"
10
- }
7
+ "value": "1970-01-01T00:00:00.000Z"
11
8
  },
12
9
  "type": "MicroLights"
13
10
  }
@@ -3,24 +3,15 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "commandAttr_info": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "commandResult",
8
- "@value": " "
9
- }
6
+ "value": " "
10
7
  },
11
8
  "commandAttr_status": {
12
9
  "type": "Property",
13
- "value": {
14
- "@type": "commandStatus",
15
- "@value": "UNKNOWN"
16
- }
10
+ "value": "UNKNOWN"
17
11
  },
18
12
  "hardcodedAttr": {
19
13
  "type": "Property",
20
- "value": {
21
- "@type": "hardcodedType",
22
- "@value": "hardcodedValue"
23
- }
14
+ "value": "hardcodedValue"
24
15
  },
25
16
  "id": "urn:ngsi-ld:TheLightType:TheFirstLight",
26
17
  "type": "TheLightType"
@@ -3,24 +3,15 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "commandAttr_info": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "commandResult",
8
- "@value": " "
9
- }
6
+ "value": " "
10
7
  },
11
8
  "commandAttr_status": {
12
9
  "type": "Property",
13
- "value": {
14
- "@type": "commandStatus",
15
- "@value": "UNKNOWN"
16
- }
10
+ "value": "UNKNOWN"
17
11
  },
18
12
  "hardcodedAttr": {
19
13
  "type": "Property",
20
- "value": {
21
- "@type": "hardcodedType",
22
- "@value": "hardcodedValue"
23
- }
14
+ "value": "hardcodedType"
24
15
  },
25
16
  "id": "urn:ngsi-ld:TheLightType:TheFirstLight",
26
17
  "type": "TheLightType"
@@ -5,45 +5,27 @@
5
5
  "type": "TheLightType",
6
6
  "hardcodedAttr": {
7
7
  "type": "Property",
8
- "value": {
9
- "@type": "hardcodedType",
10
- "@value": "hardcodedValue"
11
- }
8
+ "value": "hardcodedType"
12
9
  },
13
10
  "bootstrapServer": {
14
11
  "type": "Property",
15
- "value": {
16
- "@type": "Address",
17
- "@value": "127.0.0.1"
18
- }
12
+ "value": "127.0.0.1"
19
13
  },
20
14
  "commandAttr_status": {
21
15
  "type": "Property",
22
- "value": {
23
- "@type": "commandStatus",
24
- "@value": "UNKNOWN"
25
- }
16
+ "value": "UNKNOWN"
26
17
  },
27
18
  "commandAttr_info": {
28
19
  "type": "Property",
29
- "value": {
30
- "@type": "commandResult",
31
- "@value": " "
32
- }
20
+ "value": "commandResult",
33
21
  },
34
22
  "wheel1_status": {
35
23
  "type": "Property",
36
- "value": {
37
- "@type": "commandStatus",
38
- "@value": "UNKNOWN"
39
- }
24
+ "value": "commandStatus"
40
25
  },
41
26
  "wheel1_info": {
42
27
  "type": "Property",
43
- "value": {
44
- "@type": "commandResult",
45
- "@value": " "
46
- }
28
+ "value": "commandResult"
47
29
  }
48
30
  }
49
31
  ]
@@ -9,10 +9,7 @@
9
9
  },
10
10
  "bootstrapServer": {
11
11
  "type": "Property",
12
- "value": {
13
- "@type": "Address",
14
- "@value": "127.0.0.1"
15
- }
12
+ "value": "127.0.0.1"
16
13
  }
17
14
  }
18
15
  ]
@@ -3,10 +3,7 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "dimming": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "Percentage",
8
- "@value": "87"
9
- }
6
+ "value": "87"
10
7
  },
11
8
  "id": "urn:ngsi-ld:Light:light1",
12
9
  "state": {
@@ -3,10 +3,7 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "bootstrapServer": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "Address",
8
- "@value": "127.0.0.1"
9
- }
6
+ "value": "127.0.0.1"
10
7
  },
11
8
  "id": "urn:ngsi-ld:SensorMachine:machine1",
12
9
  "status": {
@@ -3,10 +3,7 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "bootstrapServer": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "Address",
8
- "@value": "127.0.0.1"
9
- }
6
+ "value": "Address"
10
7
  },
11
8
  "id": "urn:ngsi-ld:Light:light1",
12
9
  "status": {
@@ -3,10 +3,7 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "bootstrapServer": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "Address",
8
- "@value": "127.0.0.1"
9
- }
6
+ "value": "Address"
10
7
  },
11
8
  "id": "urn:ngsi-ld:SensorMachine:Light1",
12
9
  "status": {
@@ -5,10 +5,7 @@
5
5
  "type": "Light",
6
6
  "keep_alive": {
7
7
  "type": "Property",
8
- "value": {
9
- "@type": "None",
10
- "@value": "null"
11
- }
8
+ "value": "null"
12
9
  }
13
10
  }
14
11
  ]
@@ -4,10 +4,7 @@
4
4
  "id": "urn:ngsi-ld:Light:light1",
5
5
  "tags": {
6
6
  "type": "Property",
7
- "value": {
8
- "@type": "Array",
9
- "@value": "[\"iot\",\"device\"]"
10
- }
7
+ "value":["iot","device"]
11
8
  },
12
9
  "type": "Light"
13
10
  }
@@ -4,8 +4,10 @@
4
4
  "configuration": {
5
5
  "type": "Property",
6
6
  "value": {
7
- "@type": "Object",
8
- "@value": "{\"firmware\": {\"version\": \"1.1.0\",\"hash\": \"cf23df2207d99a74fbe169e3eba035e633b65d94\"}}"
7
+ "firmware": {
8
+ "version": "1.1.0",
9
+ "hash": "cf23df2207d99a74fbe169e3eba035e633b65d94"
10
+ }
9
11
  }
10
12
  },
11
13
  "id": "urn:ngsi-ld:Light:light1",
@@ -3,10 +3,7 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "configuration": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "Object",
8
- "@value": "string_value"
9
- }
6
+ "value": "string_value"
10
7
  },
11
8
  "id": "urn:ngsi-ld:Light:light1",
12
9
  "type": "Light"
@@ -3,19 +3,13 @@
3
3
  "@context": "http://context.json-ld",
4
4
  "position_status": {
5
5
  "type": "Property",
6
- "value": {
7
- "@type": "commandStatus",
8
- "@value": "ERROR"
9
- }
6
+ "value": "ERROR"
10
7
  },
11
8
  "position_info": {
12
9
  "type": "Property",
13
- "value": {
14
- "@type": "commandResult",
15
- "@value": "Stalled"
16
- }
10
+ "value": "Stalled"
17
11
  },
18
12
  "id": "urn:ngsi-ld:Robot:r2d2",
19
13
  "type": "Robot"
20
14
  }
21
- ]
15
+ ]
@@ -1,21 +1,15 @@
1
1
  [
2
- {
3
- "@context":"http://context.json-ld",
4
- "position_status": {
5
- "type":"Property",
6
- "value": {
7
- "@type":"commandStatus",
8
- "@value":"ERROR"
9
- }
10
- },
11
- "position_info": {
12
- "type":"Property",
13
- "value": {
14
- "@type":"commandResult",
15
- "@value":"EXPIRED"
16
- }
17
- },
18
- "id":"urn:ngsi-ld:Robot:r2d2",
19
- "type":"Robot"
20
- }
2
+ {
3
+ "@context":"http://context.json-ld",
4
+ "position_status": {
5
+ "type":"Property",
6
+ "value": "ERROR"
7
+ },
8
+ "position_info": {
9
+ "type":"Property",
10
+ "value": "EXPIRED"
11
+ },
12
+ "id":"urn:ngsi-ld:Robot:r2d2",
13
+ "type":"Robot"
14
+ }
21
15
  ]
@@ -1,21 +1,15 @@
1
1
  [
2
- {
3
- "@context":"http://context.json-ld",
4
- "position_status": {
5
- "type":"Property",
6
- "value": {
7
- "@type":"commandStatus",
8
- "@value":"FINISHED"
9
- }
10
- },
11
- "position_info": {
12
- "type":"Property",
13
- "value": {
14
- "@type":"commandResult",
15
- "@value":"[72, 368, 1]"
16
- }
17
- },
18
- "id":"urn:ngsi-ld:Robot:r2d2",
19
- "type":"Robot"
20
- }
2
+ {
3
+ "@context":"http://context.json-ld",
4
+ "position_status": {
5
+ "type": "Property",
6
+ "value": "FINISHED"
7
+ },
8
+ "position_info": {
9
+ "type":"Property",
10
+ "value": [72, 368, 1]
11
+ },
12
+ "id":"urn:ngsi-ld:Robot:r2d2",
13
+ "type":"Robot"
14
+ }
21
15
  ]