Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to offer NGSI-LD 1.6.1. Registration #1302

Merged
merged 4 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

- Update to offer NGSI-LD 1.6.1. Registrations #1302
- Document removal of support for NGSI-LD 1.3.1 Interface
3 changes: 2 additions & 1 deletion doc/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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 |
18 changes: 17 additions & 1 deletion lib/services/devices/registrationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || [];
Expand All @@ -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);
Expand Down Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
],
"mode": "exclusive",
"operations": [
"retrieveOps"
],
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"@context": "http://context.json-ld"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,11 +15,13 @@
"type": "Robot"
}
],
"properties": [
"propertyNames": [
"position",
"orientation"
]
}
],
"mode": "exclusive",
"operations" :["updateOps"],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,11 +15,16 @@
"type": "TheLightType"
}
],
"properties": [
"propertyNames": [
"luminance",
"commandAttr"
]
}
],
"mode": "exclusive",
"operations": [
"retrieveOps",
"updateOps"
],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,10 +15,12 @@
"type": "TheLightType"
}
],
"properties": [
"propertyNames": [
"luminance"
]
}
],
"mode": "exclusive",
"operations" :["retrieveOps"],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,13 +15,18 @@
"type": "TheLightType"
}
],
"properties": [
"propertyNames": [
"luminance",
"luminescence",
"commandAttr",
"wheel1"
]
}
],
"mode": "exclusive",
"operations": [
"retrieveOps",
"updateOps"
],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,13 +15,18 @@
"type": "SensorMachine"
}
],
"properties": [
"propertyNames": [
"luminance",
"luminescence",
"commandAttr",
"wheel1"
]
}
],
"mode": "exclusive",
"operations" : [
"retrieveOps",
"updateOps"
],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"@context": "http://context.json-ld",
"endpoint": "http://smartgondor.com",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information": [
{
"entities": [
Expand All @@ -9,10 +15,12 @@
"type": "Light"
}
],
"properties": [
"propertyNames": [
"temperature"
]
}
],
"mode": "exclusive",
"operations" :["retrieveOps"],
"type": "ContextSourceRegistration"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"type":"ContextSourceRegistration",
"contextSourceInfo":[
{
"key": "jsonldContext",
"value": "http://context.json-ld"
}
],
"information":[
{
"entities":[
Expand All @@ -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"
}
}
Loading