From c29e67d687008621c692f452f35e778dd33511ff Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:34:57 +0100 Subject: [PATCH 01/15] Add ngsi type and id doc --- docs/usermanual.md | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 806ce387..245145f8 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -116,10 +116,36 @@ tools available online like [this one](https://string-functions.com/string-hex.a It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure -attributes and `id` and `type` are ignored, since `id` and `type` from device/group configuration provisioned are used, -as well as `actionType`. +attributes. The entity `id` and `type` are are also include as attributes `ngsi_id` and `ngsi_type` (both with attribute +type `string`). Destination entity `id` and entity `type` from device/group configuration provisioned are used, +as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` +at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) -Examples of these `ngsiv2` payloads are the following ones: +Taking as an example the follwing entity as measure: + +```json +{ + "id": "MyEntityId1", + "type": "MyEntityType1", + "attr1": { "type": "Text", "value": "MyAttr1Value"} +} +``` + +It would generate an entity like the following one + +```json +{ + "id":"MyProvisionID", + "type":"MyProvisionType", + "attr1": { "type": "Text", "value": "MyAttr1Value"}, + "ngsi_id": {"type":"string","value":"MyEntityId1"}, + "ngsi_type":{"type":"string","value":"MyEntityType1"} +} +``` + +The IoTA is able to ingest different types of `NGSI-V2` and `NGSI-LD` payloads like the following ones: + +**NGSI-V2** (1) NGSI-v2 batch update format: @@ -172,7 +198,7 @@ Examples of these `ngsiv2` payloads are the following ones: ``` -Example of these `ngsild` payloads are the following ones: +**NGSI-LD** (1) NGSI-LD entities array format: From af8f7dc1fb025cdef044b7c50d06a317120e3619 Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:37:38 +0100 Subject: [PATCH 02/15] fix typo --- docs/usermanual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 245145f8..e10ca261 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -116,7 +116,7 @@ tools available online like [this one](https://string-functions.com/string-hex.a It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure -attributes. The entity `id` and `type` are are also include as attributes `ngsi_id` and `ngsi_type` (both with attribute +attributes. The entity `id` and `type` are also include as attributes `ngsi_id` and `ngsi_type` (both with attribute type `string`). Destination entity `id` and entity `type` from device/group configuration provisioned are used, as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) From e07b04f561fa98689626fd2eab98386c3b8e7582 Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:44:51 +0100 Subject: [PATCH 03/15] Clarify examples --- docs/usermanual.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index e10ca261..9935dcb7 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -121,7 +121,7 @@ type `string`). Destination entity `id` and entity `type` from device/group conf as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) -Taking as an example the follwing entity as measure: +Given an incoming **measure** ad the follwing one: ```json { @@ -131,7 +131,7 @@ Taking as an example the follwing entity as measure: } ``` -It would generate an entity like the following one +It would persist an entity into the Context Broker like the following one: ```json { From 58e46382ac3dee67ab650e3c770aff3838d640f7 Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:45:52 +0100 Subject: [PATCH 04/15] fix typo --- docs/usermanual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 9935dcb7..dbc05236 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -121,7 +121,7 @@ type `string`). Destination entity `id` and entity `type` from device/group conf as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) -Given an incoming **measure** ad the follwing one: +Given an incoming **measure** as the follwing one: ```json { From a9485d45118a668dc14ab84ee22bb01de1126914 Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:58:43 +0100 Subject: [PATCH 05/15] Add link to iota lib --- docs/usermanual.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index dbc05236..629dcf0b 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -116,8 +116,9 @@ tools available online like [this one](https://string-functions.com/string-hex.a It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure -attributes. The entity `id` and `type` are also include as attributes `ngsi_id` and `ngsi_type` (both with attribute -type `string`). Destination entity `id` and entity `type` from device/group configuration provisioned are used, +attributes. The entity `id` and `type` are also include as attributes `measure_id` and `measure_type` as described +[here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using +attribute type `string`). Destination entity `id` and entity `type` is taken from device/group configuration or provision, as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) From 4f12b2fd44311df1f1b4482c2b290805502131c0 Mon Sep 17 00:00:00 2001 From: mapedraza <40356341+mapedraza@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:06:47 +0100 Subject: [PATCH 06/15] fix lint --- docs/usermanual.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 629dcf0b..5f491e4a 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -116,10 +116,10 @@ tools available online like [this one](https://string-functions.com/string-hex.a It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure -attributes. The entity `id` and `type` are also include as attributes `measure_id` and `measure_type` as described +attributes. The entity ID and type are also include as attributes `measure_id` and `measure_type` as described [here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using -attribute type `string`). Destination entity `id` and entity `type` is taken from device/group configuration or provision, -as well as `actionType`. It is possible to use the same entity `id` that the original one by using `entityNameExp` +attribute type `string`). Destination entity ID and entity type is taken from device/group configuration or provision, +as well as `actionType`. It is possible to use the same entity ID that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) Given an incoming **measure** as the follwing one: From 42cac990b118ef486f06f643367ec3f7f5d3d484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 31 Jan 2024 11:12:55 +0100 Subject: [PATCH 07/15] Update docs/usermanual.md Co-authored-by: mapedraza <40356341+mapedraza@users.noreply.github.com> --- docs/usermanual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index fd2ac3f5..09bfaa8e 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -118,7 +118,7 @@ It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related dev `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure attributes. The entity ID and type are also include as attributes `measure_id` and `measure_type` as described [here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using -attribute type `string`). Destination entity ID and entity type is taken from device/group configuration or provision, +attribute type `string`(**FIXME [#810](https://github.com/telefonicaid/iotagent-json/issues/810)**: The type is going to be changed to `Text` instead of `string` )). Destination entity ID and entity type is taken from device/group configuration or provision, as well as `actionType`. It is possible to use the same entity ID that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) From 22afdd2eda55a9d8c3aa3c73c2817716bc1e2e42 Mon Sep 17 00:00:00 2001 From: Keshav-NEC Date: Wed, 31 Jan 2024 12:14:00 +0000 Subject: [PATCH 08/15] constants.DEFAULT_ATTRIBUTE_TYPE is changed to Text --- lib/constants.js | 2 +- .../unit/ngsiv2/contextRequests/ngsildMeasure.json | 5 ++--- .../contextRequests/ngsildPayloadMeasure.json | 4 ++-- .../contextRequests/ngsildPayloadMeasure2.json | 4 ++-- .../unit/ngsiv2/contextRequests/ngsiv2Measure.json | 4 ++-- .../contextRequests/ngsiv2PayloadMeasure.json | 4 ++-- .../contextRequests/ngsiv2PayloadMeasure2.json | 4 ++-- .../ngsiv2/contextRequests/pollingMeasure.json | 2 +- .../contextRequests/timeInstantMeasures3.json | 2 +- .../ngsiv2/contextRequests/unknownMeasures.json | 2 +- .../ngsiv2/contextRequests/unknownMeasures2.json | 2 +- .../contextRequests/unprovisionedDevice.json | 4 ++-- .../contextRequests/unprovisionedDevice2.json | 4 ++-- .../contextRequests/unprovisionedDevice3.json | 2 +- test/unit/ngsiv2/explicit_attributes-test.js | 14 +++++++------- 15 files changed, 29 insertions(+), 30 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index ded40757..f0abf088 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -42,7 +42,7 @@ module.exports = { TIMESTAMP_ATTRIBUTE: 'TimeInstant', TIMESTAMP_TYPE_NGSI2: 'DateTime', - DEFAULT_ATTRIBUTE_TYPE: 'string', + DEFAULT_ATTRIBUTE_TYPE: 'Text', COMMAND_STATUS_PENDING: 'PENDING', COMMAND_STATUS_ERROR: 'ERROR', diff --git a/test/unit/ngsiv2/contextRequests/ngsildMeasure.json b/test/unit/ngsiv2/contextRequests/ngsildMeasure.json index 76d01b9a..f975c0b7 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsildMeasure.json @@ -3,7 +3,7 @@ "type": "AnMQTTDevice", "actionType": { "value": "APPEND", - "type": "string" + "type": "Text" }, "entities": { "value": [ @@ -45,7 +45,6 @@ ] } ], - "type": "string" + "type": "Text" } } - diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json index 3d7965f1..8d6c703e 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsi-ld:ParkingSpot:santander:daoiz_velarde_1_5:3" }, "measure_type": { - "type": "string", + "type": "Text", "value": "ParkingSpot" }, "status": { diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json index 6dd1c3d4..0594bffe 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsi-ld:ParkingSpot:santander:reyes_magos_1_1:1" }, "measure_type": { - "type": "string", + "type": "Text", "value": "ParkingSpot" }, "status": { diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json b/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json index 7151f1b1..c304e1bd 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json @@ -3,7 +3,7 @@ "type":"AnMQTTDevice", "actionType": { "value": "APPEND", - "type": "string" + "type": "Text" }, "entities": { "value": [ @@ -56,6 +56,6 @@ } } ], - "type": "string" + "type": "Text" } } diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json index 7b976234..eb1e9080 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json @@ -2,11 +2,11 @@ "id":"Second MQTT Device", "type":"AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-2" }, "measure_type": { - "type": "string", + "type": "Text", "value": "Streetlight" }, "name": { diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json index 49fdc263..c90bf8bd 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-3" }, "measure_type": { - "type": "string", + "type": "Text", "value": "Streetlight" }, "name": { diff --git a/test/unit/ngsiv2/contextRequests/pollingMeasure.json b/test/unit/ngsiv2/contextRequests/pollingMeasure.json index 7c88ac53..ca3eef03 100644 --- a/test/unit/ngsiv2/contextRequests/pollingMeasure.json +++ b/test/unit/ngsiv2/contextRequests/pollingMeasure.json @@ -2,7 +2,7 @@ "id":"Second MQTT Device", "type":"AnMQTTDevice", "a": { - "type": "string", + "type": "Text", "value": 23 } } diff --git a/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json b/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json index 83b4145b..bafa4ed6 100644 --- a/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json +++ b/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json @@ -6,7 +6,7 @@ "value": "111222" }, "pressure":{ - "type": "string", + "type": "Text", "value": "20" }, "TimeInstant":{ diff --git a/test/unit/ngsiv2/contextRequests/unknownMeasures.json b/test/unit/ngsiv2/contextRequests/unknownMeasures.json index 55d1f864..e2ffad3a 100644 --- a/test/unit/ngsiv2/contextRequests/unknownMeasures.json +++ b/test/unit/ngsiv2/contextRequests/unknownMeasures.json @@ -6,7 +6,7 @@ "value": "32" }, "weight":{ - "type": "string", + "type": "Text", "value": "87" } } diff --git a/test/unit/ngsiv2/contextRequests/unknownMeasures2.json b/test/unit/ngsiv2/contextRequests/unknownMeasures2.json index b7b61181..8d28f502 100644 --- a/test/unit/ngsiv2/contextRequests/unknownMeasures2.json +++ b/test/unit/ngsiv2/contextRequests/unknownMeasures2.json @@ -6,7 +6,7 @@ "value": "33" }, "weight":{ - "type": "string", + "type": "Text", "value": "89" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json index 31c74e22..31afe9c3 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json @@ -2,11 +2,11 @@ "id":"TheLightType:JSON_UNPROVISIONED", "type":"TheLightType", "humidity":{ - "type": "string", + "type": "Text", "value": "32" }, "temperature":{ - "type": "string", + "type": "Text", "value": "87" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json index bd2aa561..f29fa1e1 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json @@ -2,11 +2,11 @@ "id":"TheLightType:JSON_UNPROVISIONED", "type":"TheLightType", "humidity":{ - "type": "string", + "type": "Text", "value": "33" }, "temperature":{ - "type": "string", + "type": "Text", "value": "89" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json index a5493ad1..781e3417 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json @@ -2,7 +2,7 @@ "id": "TheLightType:JSON_UNPROVISIONED", "type": "TheLightType", "h":{ - "type": "string", + "type": "Text", "value": "33" } } diff --git a/test/unit/ngsiv2/explicit_attributes-test.js b/test/unit/ngsiv2/explicit_attributes-test.js index bc23f61a..ff9d7f72 100755 --- a/test/unit/ngsiv2/explicit_attributes-test.js +++ b/test/unit/ngsiv2/explicit_attributes-test.js @@ -242,7 +242,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -434,7 +434,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -506,7 +506,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -652,7 +652,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -699,7 +699,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -771,7 +771,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -917,7 +917,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); From 8fcfa0aa227e14c9a1f113ca854c11a2b51d3912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 31 Jan 2024 15:49:20 +0100 Subject: [PATCH 09/15] Update docs/usermanual.md --- docs/usermanual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 09bfaa8e..bad8bc07 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -118,7 +118,7 @@ It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related dev `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure attributes. The entity ID and type are also include as attributes `measure_id` and `measure_type` as described [here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using -attribute type `string`(**FIXME [#810](https://github.com/telefonicaid/iotagent-json/issues/810)**: The type is going to be changed to `Text` instead of `string` )). Destination entity ID and entity type is taken from device/group configuration or provision, +attribute type `string` (**FIXME [#810](https://github.com/telefonicaid/iotagent-json/issues/810)**: The type is going to be changed to `Text` instead of `string` , fix also examples above). Destination entity ID and entity type is taken from device/group configuration or provision, as well as `actionType`. It is possible to use the same entity ID that the original one by using `entityNameExp` at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) From 8e5ca24a795340ac3221b3d2b8a5a6a2bc1af336 Mon Sep 17 00:00:00 2001 From: Keshav-NEC Date: Thu, 1 Feb 2024 05:38:05 +0000 Subject: [PATCH 10/15] modified package.json --- CHANGES_NEXT_RELEASE | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29b..9bf01099 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: DEFAULT_ATTRIBUTE_TYPE is changed to Text (#810) diff --git a/package.json b/package.json index 4bab8063..2a92291e 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "body-parser-xml": "2.0.5", "dateformat": "3.0.3", "express": "4.18.1", - "iotagent-node-lib": "https://github.com/telefonicaid/iotagent-node-lib.git#master", + "iotagent-node-lib": "https://github.com/Keshav-NEC/iotagent-node-lib.git#Fix_for_1569", "logops": "2.1.2", "mqtt": "4.3.7", "sinon": "~6.1.0", From ab59c2029d1195ddbbae1a05e9a689ce42b7bc47 Mon Sep 17 00:00:00 2001 From: Keshav-NEC <102344018+Keshav-NEC@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:17:23 +0530 Subject: [PATCH 11/15] Update CHANGES_NEXT_RELEASE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- CHANGES_NEXT_RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9bf01099..b95c121e 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1 @@ -- Fix: DEFAULT_ATTRIBUTE_TYPE is changed to Text (#810) +- Fix: default attribute type changed from 'string' to 'Text' (#810) From 5f6fc33ab0c92202ac3afebd6dc4ca39ff97dd75 Mon Sep 17 00:00:00 2001 From: Keshav-NEC <102344018+Keshav-NEC@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:51:38 +0530 Subject: [PATCH 12/15] Update package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a92291e..4bab8063 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "body-parser-xml": "2.0.5", "dateformat": "3.0.3", "express": "4.18.1", - "iotagent-node-lib": "https://github.com/Keshav-NEC/iotagent-node-lib.git#Fix_for_1569", + "iotagent-node-lib": "https://github.com/telefonicaid/iotagent-node-lib.git#master", "logops": "2.1.2", "mqtt": "4.3.7", "sinon": "~6.1.0", From be50c5141389847c7fb83675b1d1844c08862c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 1 Feb 2024 17:43:20 +0100 Subject: [PATCH 13/15] FIX improve usermanual.md --- docs/usermanual.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index bad8bc07..6cf75053 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -116,13 +116,23 @@ tools available online like [this one](https://string-functions.com/string-hex.a It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with `payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure -attributes. The entity ID and type are also include as attributes `measure_id` and `measure_type` as described +attributes. + +Note that the entity ID and type in the measure are also include as attributes `measure_id` and `measure_type` as described [here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using -attribute type `string` (**FIXME [#810](https://github.com/telefonicaid/iotagent-json/issues/810)**: The type is going to be changed to `Text` instead of `string` , fix also examples above). Destination entity ID and entity type is taken from device/group configuration or provision, -as well as `actionType`. It is possible to use the same entity ID that the original one by using `entityNameExp` -at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel) +attribute type `Text`). The ID and type of the entity updated at Context Broker is taken from device/group configuration or provision, + +However, it is possible to use the same entity ID that the original one by using `entityNameExp` +at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel), this way: + +``` +"entityNameExp": "measure_type" +``` + +The `actionType` used in the update sent to Context Broker is taken from the measure in the case that measure corresponds to +a NGSI-v2 batch update. In other cases (i.e. NGSI-LD or NGSI-v2 non-bath update), the `actionType` is the default one (`append`). -Given an incoming **measure** as the follwing one: +For instance, given an incoming **measure** as the follwing one: ```json { @@ -139,8 +149,8 @@ It would persist an entity into the Context Broker like the following one: "id":"MyProvisionID", "type":"MyProvisionType", "attr1": { "type": "Text", "value": "MyAttr1Value"}, - "ngsi_id": {"type":"string","value":"MyEntityId1"}, - "ngsi_type":{"type":"string","value":"MyEntityType1"} + "ngsi_id": {"type": "Text","value":"MyEntityId1"}, + "ngsi_type":{"type": "Text","value":"MyEntityType1"} } ``` From a39a4aefffcb49d97346f011900b3a2c4cba9dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 1 Feb 2024 17:43:46 +0100 Subject: [PATCH 14/15] FIX typo --- docs/usermanual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 6cf75053..1b45f47f 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -126,7 +126,7 @@ However, it is possible to use the same entity ID that the original one by using at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel), this way: ``` -"entityNameExp": "measure_type" +"entityNameExp": "measure_id" ``` The `actionType` used in the update sent to Context Broker is taken from the measure in the case that measure corresponds to From 2fd7f8d56653521db4085f085e816e7c9ee7cc15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 2 Feb 2024 10:44:34 +0100 Subject: [PATCH 15/15] Apply suggestions from code review --- docs/usermanual.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usermanual.md b/docs/usermanual.md index 1b45f47f..f7d602e2 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -130,7 +130,7 @@ at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/bl ``` The `actionType` used in the update sent to Context Broker is taken from the measure in the case that measure corresponds to -a NGSI-v2 batch update. In other cases (i.e. NGSI-LD or NGSI-v2 non-bath update), the `actionType` is the default one (`append`). +a NGSI-v2 batch update. In other cases (i.e. NGSI-LD or NGSI-v2 non-batch update), the `actionType` is the default one (`append`). For instance, given an incoming **measure** as the follwing one: @@ -149,8 +149,8 @@ It would persist an entity into the Context Broker like the following one: "id":"MyProvisionID", "type":"MyProvisionType", "attr1": { "type": "Text", "value": "MyAttr1Value"}, - "ngsi_id": {"type": "Text","value":"MyEntityId1"}, - "ngsi_type":{"type": "Text","value":"MyEntityType1"} + "measure_id": {"type": "Text","value": "MyEntityId1"}, + "measure_type":{"type": "Text","value": "MyEntityType1"} } ```