diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index d3f5a12fa..f9a3a1d1f 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - +- Update to offer NGSI-LD 1.6.1. Registrations #1302 +- Document removal of support for NGSI-LD 1.3.1 Interface diff --git a/doc/deprecated.md b/doc/deprecated.md index 6994f3810..86954d793 100644 --- a/doc/deprecated.md +++ b/doc/deprecated.md @@ -18,7 +18,7 @@ A list of deprecated features and the version in which they were deprecated foll - Support to Node.js v8 in iotagent-node-lib 2.12.0 (finally removed in 2.13.0) - Support to Node.js v10 in iotagent-node-lib 2.15.0 (finally removed in 2.16.0) - Support to Node.js v12 in iotagent-node-lib 2.24.0 (finally removed in 2.25.0) -- Support to NGSI-LD v1.3 in iotagent-node-lib 2.25.0 +- Support to NGSI-LD v1.3 in iotagent-node-lib 2.25.0 (finally removed in 2.26.0) The use of Node.js v14 is highly recommended. @@ -46,3 +46,4 @@ The following table provides information about the last iotagent-node-lib versio | Support to Node.js v8 | 2.12.0 | April 7th, 2020 | | Support to Node.js v10 | 2.15.0 | February 18th, 2021 | | Support to Node.js v12 | 2.24.0 | September 2nd, 2022 | +| Support to NGSI-LD 1.3 | 2.25.0 | January 24th, 2023 | diff --git a/lib/services/devices/registrationUtils.js b/lib/services/devices/registrationUtils.js index 8ebf50456..7755fb921 100644 --- a/lib/services/devices/registrationUtils.js +++ b/lib/services/devices/registrationUtils.js @@ -310,6 +310,7 @@ function sendRegistrationsNgsiLD(unregister, deviceData, callback) { return sendUnregistrationsNgsiLD(deviceData, callback); } + const operations = []; const properties = []; const lazy = deviceData.lazy || []; const commands = deviceData.commands || []; @@ -321,6 +322,13 @@ function sendRegistrationsNgsiLD(unregister, deviceData, callback) { properties.push(element.name); }); + if (lazy.length > 0){ + operations.push('retrieveOps'); + } + if (commands.length > 0){ + operations.push('updateOps'); + } + if (properties.length === 0) { logger.debug(context, 'Registration with Context Provider is not needed. Device without lazy atts or commands'); return callback(null, deviceData); @@ -348,10 +356,18 @@ function sendRegistrationsNgsiLD(unregister, deviceData, callback) { information: [ { entities: [{ type: deviceData.type, id }], - properties + propertyNames: properties } ], + mode: 'exclusive', + operations, endpoint: config.getConfig().providerUrl, + contextSourceInfo: [ + { + 'key': 'jsonldContext', + 'value': config.getConfig().contextBroker.jsonLdContext + } + ], '@context': config.getConfig().contextBroker.jsonLdContext }, headers: { diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json index d4bc20d78..8ab9bcc7d 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json @@ -1,18 +1,28 @@ { - "@context": "http://context.json-ld", - "endpoint": "http://smartgondor.com", - "information": [ + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ { - "entities": [ - { - "id": "urn:ngsi-ld:Light:light1", - "type": "Light" - } - ], - "properties": [ - "temperature" - ] + "type": "Light", + "id": "urn:ngsi-ld:Light:light1" } - ], - "type": "ContextSourceRegistration" + ], + "propertyNames": [ + "temperature" + ] + } + ], + "mode": "exclusive", + "operations": [ + "retrieveOps" + ], + "endpoint": "http://smartgondor.com", + "contextSourceInfo": [ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], + "@context": "http://context.json-ld" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent2.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent2.json index 0b71611d5..f854d7077 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent2.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent2.json @@ -1,18 +1,28 @@ { - "type": "ContextSourceRegistration", - "information": [ - { - "entities": [ + "type": "ContextSourceRegistration", + "information": [ { - "type": "Motion", - "id": "urn:ngsi-ld:Motion:motion1" + "entities": [ + { + "type": "Motion", + "id": "urn:ngsi-ld:Motion:motion1" + } + ], + "propertyNames": [ + "moving" + ] } - ], - "properties": [ - "moving" - ] - } - ], - "endpoint": "http://smartgondor.com", - "@context": "http://context.json-ld" -} \ No newline at end of file + ], + "mode": "exclusive", + "operations": [ + "retrieveOps" + ], + "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], + "@context": "http://context.json-ld" +} diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent4.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent4.json index d4ad776ed..8ab9bcc7d 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent4.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent4.json @@ -4,15 +4,25 @@ { "entities": [ { - "type": "RobotPre", - "id": "urn:ngsi-ld:RobotPre:TestRobotPre" + "type": "Light", + "id": "urn:ngsi-ld:Light:light1" } ], - "properties": [ - "moving" + "propertyNames": [ + "temperature" ] } ], + "mode": "exclusive", + "operations": [ + "retrieveOps" + ], "endpoint": "http://smartgondor.com", + "contextSourceInfo": [ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "@context": "http://context.json-ld" -} \ No newline at end of file +} diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgentCommands.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgentCommands.json index c1bb4f2ea..b1ab52a6c 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgentCommands.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgentCommands.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,11 +15,13 @@ "type": "Robot" } ], - "properties": [ + "propertyNames": [ "position", "orientation" ] } ], + "mode": "exclusive", + "operations" :["updateOps"], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice.json index 3e0c0ee89..84826dddb 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,11 +15,16 @@ "type": "TheLightType" } ], - "properties": [ + "propertyNames": [ "luminance", "commandAttr" ] } ], + "mode": "exclusive", + "operations": [ + "retrieveOps", + "updateOps" + ], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice2.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice2.json index cbc564de8..f76897e7b 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice2.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice2.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,10 +15,12 @@ "type": "TheLightType" } ], - "properties": [ + "propertyNames": [ "luminance" ] } ], + "mode": "exclusive", + "operations" :["retrieveOps"], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json index 4e048db8c..045959dc7 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,7 +15,7 @@ "type": "TheLightType" } ], - "properties": [ + "propertyNames": [ "luminance", "luminescence", "commandAttr", @@ -17,5 +23,10 @@ ] } ], + "mode": "exclusive", + "operations": [ + "retrieveOps", + "updateOps" + ], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json index 853f878a4..3902d97b1 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,7 +15,7 @@ "type": "SensorMachine" } ], - "properties": [ + "propertyNames": [ "luminance", "luminescence", "commandAttr", @@ -17,5 +23,10 @@ ] } ], + "mode": "exclusive", + "operations" : [ + "retrieveOps", + "updateOps" + ], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json index d4bc20d78..0a9b781c3 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,10 +15,12 @@ "type": "Light" } ], - "properties": [ + "propertyNames": [ "temperature" ] } ], + "mode": "exclusive", + "operations" :["retrieveOps"], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateCommands1.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateCommands1.json index f577b98b3..c8b3f2e17 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateCommands1.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateCommands1.json @@ -1,5 +1,11 @@ { "type":"ContextSourceRegistration", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information":[ { "entities":[ @@ -8,11 +14,13 @@ "id":"urn:ngsi-ld:Light:light1" } ], - "properties":[ + "propertyNames":[ "move" ] } ], + "mode": "exclusive", + "operations":["updateOps"], "endpoint":"http://smartgondor.com", "@context": "http://context.json-ld" -} \ No newline at end of file +} diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent1.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent1.json index f27b0d21b..23fc87093 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent1.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent1.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,10 +15,14 @@ "type": "Light" } ], - "properties": [ + "propertyNames": [ "pressure" ] } ], + "mode": "exclusive", + "operations": [ + "retrieveOps" + ], "type": "ContextSourceRegistration" } diff --git a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent2.json b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent2.json index 276b69e75..b42ff0522 100644 --- a/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent2.json +++ b/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent2.json @@ -1,6 +1,12 @@ { "@context": "http://context.json-ld", "endpoint": "http://smartgondor.com", + "contextSourceInfo":[ + { + "key": "jsonldContext", + "value": "http://context.json-ld" + } + ], "information": [ { "entities": [ @@ -9,11 +15,16 @@ "type": "TheLightType" } ], - "properties": [ + "propertyNames": [ "luminance", "commandAttr" ] } ], + "mode": "exclusive", + "operations" : [ + "retrieveOps", + "updateOps" + ], "type": "ContextSourceRegistration" }