Skip to content

Commit

Permalink
Merge pull request #1638 from telefonicaid/task/update-templates
Browse files Browse the repository at this point in the history
Remove bidirectional leftovers (reverse option)
  • Loading branch information
fgalan authored Aug 7, 2024
2 parents 2bfa8ea + 1bb13b7 commit f81fb08
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 233 deletions.
1 change: 0 additions & 1 deletion lib/services/northBound/deviceProvisioningServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ function attributeToProvisioningAPIFormat(attribute) {
type: attribute.type,
expression: attribute.expression,
skipValue: attribute.skipValue,
reverse: attribute.reverse,
entity_name: attribute.entity_name,
entity_type: attribute.entity_type,
mqtt: attribute.mqtt,
Expand Down
24 changes: 0 additions & 24 deletions lib/templates/createDevice.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,30 +119,6 @@
"type": "string",
"pattern": "^([^<>;'=\"]+)+$"
},
"reverse": {
"description": "Define the attribute as bidirectional",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"object_id": {
"description": "ID of the attribute in the device",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"type": {
"description": "Type of the attribute in the target entity",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"expression": {
"description": "Optional expression for measurement transformation",
"type": "string"
}
}
}
},
"metadata": {
"description": "Attribute Metadata",
"type": "object"
Expand Down
23 changes: 0 additions & 23 deletions lib/templates/createDeviceLax.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,6 @@
"description": "Optional entity type for multientity updatess",
"type": "string",
"pattern": "^([^<>;'=\"]+)+$"
},
"reverse": {
"description": "Define the attribute as bidirectional",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"object_id": {
"description": "ID of the attribute in the device",
"type": "string"
},
"type": {
"description": "Type of the attribute in the target entity",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"expression": {
"description": "Optional expression for measurement transformation",
"type": "string"
}
}
}
}
}
}
Expand Down
26 changes: 1 addition & 25 deletions lib/templates/deviceGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,9 @@
"commands": {
"description": "list of commands of the devices",
"type": "array"
},
"reverse": {
"description": "Define the attribute as bidirectional",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"object_id": {
"description": "ID of the attribute in the device",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"type": {
"description": "Type of the attribute in the target entity",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"expression": {
"description": "Optional expression for measurement transformation",
"type": "string"
}
}
}
}
}
}
}
}
}
}
25 changes: 0 additions & 25 deletions lib/templates/queryContext.json

This file was deleted.

24 changes: 0 additions & 24 deletions lib/templates/updateDevice.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,6 @@
"type": "string",
"pattern": "^([^<>;'=\"]+)+$"
},
"reverse": {
"description": "Define the attribute as bidirectional",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"object_id": {
"description": "ID of the attribute in the device",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"type": {
"description": "Type of the attribute in the target entity",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"expression": {
"description": "Optional expression for measurement transformation",
"type": "string"
}
}
}
},
"metadata": {
"description": "Attribute Metadata",
"type": "object"
Expand Down
23 changes: 0 additions & 23 deletions lib/templates/updateDeviceLax.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,6 @@
"description": "Optional entity type for multientity updatess",
"type": "string",
"pattern": "^([^<>;'=\"]+)+$"
},
"reverse": {
"description": "Define the attribute as bidirectional",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"object_id": {
"description": "ID of the attribute in the device",
"type": "string"
},
"type": {
"description": "Type of the attribute in the target entity",
"type": "string",
"pattern": "^([^<>();'=\"]+)+$"
},
"expression": {
"description": "Optional expression for measurement transformation",
"type": "string"
}
}
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion scripts/legacy_expression_tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ The script implements expression detection and translation in the following fiel

- active.expression
- active.entity_name
- active.reverse
- attributes.expression
- attributes.entity_name
- attributes.expression
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,7 @@
{
"name":"location",
"type":"geo:point",
"expression": "${latitude}, ${longitude}",
"reverse": [
{
"object_id":"latitude",
"type": "string",
"expression": "${trim(substr(@location, indexOf(@location, \",\") + 1, length(@location)))}"
},
{
"object_id":"longitude",
"type": "string",
"expression": "${trim(substr(@location, 0, indexOf(@location, \",\")))}"
}
]
"expression": "${latitude}, ${longitude}"
}
],
"static_attributes": [],
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,9 @@ describe('NGSI-LD - Device provisioning API: List provisioned devices', function
should.exist(body.devices[2].attributes[0].entity_name);
should.exist(body.devices[2].attributes[0].entity_type);
should.exist(body.devices[2].attributes[1].expression);
should.exist(body.devices[2].attributes[2].reverse);
body.devices[2].attributes[0].entity_name.should.equal('Higro2000');
body.devices[2].attributes[0].entity_type.should.equal('Higrometer');
body.devices[2].attributes[1].expression.should.equal('${@humidity * 20}');
body.devices[2].attributes[2].reverse.length.should.equal(2);
done();
});
});
Expand Down Expand Up @@ -245,11 +243,9 @@ describe('NGSI-LD - Device provisioning API: List provisioned devices', function
should.exist(body.attributes[0].entity_name);
should.exist(body.attributes[0].entity_type);
should.exist(body.attributes[1].expression);
should.exist(body.attributes[2].reverse);
body.attributes[0].entity_name.should.equal('Higro2000');
body.attributes[0].entity_type.should.equal('Higrometer');
body.attributes[1].expression.should.equal('${@humidity * 20}');
body.attributes[2].reverse.length.should.equal(2);
done();
});
});
Expand Down
4 changes: 0 additions & 4 deletions test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,9 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
should.exist(body.devices[2].attributes[0].entity_name);
should.exist(body.devices[2].attributes[0].entity_type);
should.exist(body.devices[2].attributes[1].expression);
should.exist(body.devices[2].attributes[2].reverse);
body.devices[2].attributes[0].entity_name.should.equal('Higro2000');
body.devices[2].attributes[0].entity_type.should.equal('Higrometer');
body.devices[2].attributes[1].expression.should.equal('${@humidity * 20}');
body.devices[2].attributes[2].reverse.length.should.equal(2);
done();
});
});
Expand Down Expand Up @@ -242,11 +240,9 @@ describe('NGSI-v2 - Device provisioning API: List provisioned devices', function
should.exist(body.attributes[0].entity_name);
should.exist(body.attributes[0].entity_type);
should.exist(body.attributes[1].expression);
should.exist(body.attributes[2].reverse);
body.attributes[0].entity_name.should.equal('Higro2000');
body.attributes[0].entity_type.should.equal('Higrometer');
body.attributes[1].expression.should.equal('${@humidity * 20}');
body.attributes[2].reverse.length.should.equal(2);
done();
});
});
Expand Down

0 comments on commit f81fb08

Please sign in to comment.