-
Notifications
You must be signed in to change notification settings - Fork 88
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
Added Feature/config groups #1198
Conversation
CHANGES_NEXT_RELEASE
Outdated
@@ -13,3 +13,4 @@ | |||
- FIX: Remove preprocess stripping of explicitAttrs (#1151) | |||
- FIX: NGSI-LD commands are invalid. (#1185) | |||
- Upgrade logops dep from 2.1.0 to 2.1.2 due to colors dependency corruption | |||
dd /iot/configGroups API endpoints (as equivalent to /iot/services) (#752) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dd
seems to be a typo
Please solve the conflict in CHANGES_NEXT_RELEASE so unit tests can automatically run in your PR. |
It seems this is the fifth incarnation of the cgroups PR:
Just in case it can be useful (mainly for taking into account all the potential feedback spreaded over them) |
CHANGES_NEXT_RELEASE
Outdated
@@ -13,3 +13,4 @@ | |||
- FIX: Remove preprocess stripping of explicitAttrs (#1151) | |||
- FIX: NGSI-LD commands are invalid. (#1185) | |||
- Upgrade logops dep from 2.1.0 to 2.1.2 due to colors dependency corruption | |||
dd /iot/configGroups API endpoints (as equivalent to /iot/services) (#752) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dd /iot/configGroups API endpoints (as equivalent to /iot/services) (#752) | |
Add /iot/configGroups API endpoints (as equivalent to /iot/services) (#752) |
doc/api.md
Outdated
### Relationship between service groups and devices | ||
|
||
Devices may be associated to exisiting service groups (or not) based in `apiKey` matching or `type` matching (in the | ||
case `apiKey` matching fails). For instance, let's consider a situation in which a service group has been provisioned | ||
with `type=X`/`apiKey=111` and no other service group has been provisioned. | ||
|
||
- IoT Agent receives an anonymous measure with `apiKey=111`. The matching `apiKey` means the entity inherits from | ||
service group. Device entity has `type=X` and `apiKey=111` | ||
- IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=111`. The matching `apiKey` | ||
means the entity inherits from service group but type is overridden. Device entity has `type=Y` and `apiKey=111` | ||
- IoT Agent receives a provisioning request for an explicit device of `type=X`/`apiKey=222`. The matching `type` means | ||
the entity inherits from service group but `apiKey` is overridden. Device entity has `type=X` and `apiKey=222`. | ||
- IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=222`. No matching. Device | ||
entity has `type=Y` and `apiKey=222` and no service group. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not included in PR #954
doc/api.md
Outdated
| Payload Field | DB Field | Definition | Example of value | | ||
| --------------------- | -------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------- | | ||
| `device_id` | `id` | Device ID that will be used to identify the device. | UO834IO | | ||
| `service` | `service` | Name of the service the device belongs to (will be used in the fiware-service header). | smartGondor | | ||
| `service_path` | `subservice` | Name of the subservice the device belongs to (used in the fiware-servicepath header). | /gardens | | ||
| `entity_name` | `name` | Name of the entity representing the device in the Context Broker | ParkLamplight12 | | ||
| `entity_type` | `type` | Type of the entity in the Context Broker | Lamplights | | ||
| `timezone` | `timezone` | Time zone of the sensor if it has any | America/Santiago | | ||
| `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true | | ||
| `apikey` | `apikey` | Optional Apikey key string to use instead of group apikey | 9n4hb1vpwbjozzmw9f0flf9c2 | | ||
| `endpoint` | `endpoint` | Endpoint where the device is going to receive commands, if any. | http://theDeviceUrl:1234/commands | | ||
| `protocol` | `protocol` | Name of the device protocol, for its use with an IoT Manager. | IoTA-UL | | ||
| `transport` | `transport` | Name of the device transport protocol, for the IoT Agents with multiple transport protocols. | MQTT | | ||
| `attributes` | `active` | List of active attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `lazy` | `lazy` | List of lazy attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `commands` | `commands` | List of commands of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `internal_attributes` | `internalAttributes` | List of internal attributes with free format for specific IoT Agent configuration | LWM2M mappings from object URIs to attributes | | ||
| `static_attributes` | `staticAttributes` | List of static attributes to append to the entity. All the updateContext requests to the CB will have this set of attributes appended. | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, legacy is used as default value. | | ||
| `explicitAttrs` | `explicitAttrs` | optional field to support selective ignore of measures so that IOTA doesn’t progress. See details in [specific section](advanced-topics.md#explicitly-defined-attributes-explicitattrs) | (see details in specific section) | | ||
| `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. The default is `v2`. When not running in mixed mode, this field is ignored. | `v2/ld` | | ||
| Payload Field | DB Field | Definition | Example of value | | ||
| --------------------- | -------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------- | | ||
| `device_id` | `id` | Device ID that will be used to identify the device. | UO834IO | | ||
| `service` | `service` | Name of the service the device belongs to (will be used in the fiware-service header). | smartGondor | | ||
| `service_path` | `subservice` | Name of the subservice the device belongs to (used in the fiware-servicepath header). | /gardens | | ||
| `entity_name` | `name` | Name of the entity representing the device in the Context Broker | ParkLamplight12 | | ||
| `entity_type` | `type` | Type of the entity in the Context Broker | Lamplights | | ||
| `timezone` | `timezone` | Time zone of the sensor if it has any | America/Santiago | | ||
| `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true | | ||
| `apikey` | `apikey` | Optional Apikey key string to use instead of group apikey | 9n4hb1vpwbjozzmw9f0flf9c2 | | ||
| `endpoint` | `endpoint` | Endpoint where the device is going to receive commands, if any. | http://theDeviceUrl:1234/commands | | ||
| `protocol` | `protocol` | Name of the device protocol, for its use with an IoT Manager. | IoTA-UL | | ||
| `transport` | `transport` | Name of the device transport protocol, for the IoT Agents with multiple transport protocols. | MQTT | | ||
| `attributes` | `active` | List of active attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `lazy` | `lazy` | List of lazy attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `commands` | `commands` | List of commands of the device | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `internal_attributes` | `internalAttributes` | List of internal attributes with free format for specific IoT Agent configuration | LWM2M mappings from object URIs to attributes | | ||
| `static_attributes` | `staticAttributes` | List of static attributes to append to the entity. All the updateContext requests to the CB will have this set of attributes appended. | `[ { "name": "attr_name", "type": "Text" } ]` | | ||
| `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, legacy is used as default value. | | ||
| `explicitAttrs` | `explicitAttrs` | Boolean value to support selective ignore of measures for device so that IOTA doesn’t progress. If not specified default is `false`. | `true/false` | | ||
| `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. The default is `v2`. When not running in mixed mode, this field is ignored. | `v2/ld` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not included in PR #954
@@ -31,7 +31,6 @@ const domainUtils = require('../common/domain'); | |||
const middlewares = require('../common/genericMiddleware'); | |||
const intoTrans = domainUtils.intoTrans; | |||
const deviceProvisioning = require('./deviceProvisioningServer'); | |||
const deviceUpdating = require('./deviceProvisioningServer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not included in PR #954
Could you elaborate why is included here?
@@ -117,7 +117,6 @@ exports.setNotificationHandler = intoTrans(context, contextServer.setNotificatio | |||
exports.setConfigurationHandler = intoTrans(context, groupProvisioning.setConfigurationHandler); | |||
exports.setRemoveConfigurationHandler = intoTrans(context, groupProvisioning.setRemoveConfigurationHandler); | |||
exports.setProvisioningHandler = intoTrans(context, deviceProvisioning.setProvisioningHandler); | |||
exports.setUpdatingHandler = intoTrans(context, deviceUpdating.setUpdatingHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not included in PR #954
Could you elaborate why is included here?
.delete('/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8', '') | ||
.delete('/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes were not included in PR #954. Could you elaborate why are included here?
const utils = require('../../../tools/utils'); | ||
const should = require('should'); | ||
const nock = require('nock'); | ||
const request = require('request'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request dependency should be used as included in this PR #1119
const should = require('should'); | ||
const nock = require('nock'); | ||
let contextBrokerMock; | ||
const request = require('request'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request dependency should be used as included in this PR #1119
it('should return the existing device', function (done) { | ||
iotAgentLib.retrieveDevice('Light1', '801230BJKL23Y9090DSFL123HJK09H324HV8732', function (error, device) { | ||
should.not.exist(error); | ||
should.exist(device); | ||
|
||
device.id.should.equal('Light1'); | ||
done(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes were not included in PR #954. Could you elaborate why are included here?
const _ = require('underscore'); | ||
const utils = require('../../tools/utils'); | ||
const async = require('async'); | ||
const request = require('request'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request dependency should be used as included in this PR #1119
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be9e2b8
@mapedraza please review this commit . I did all the required changes.
Additionally to the comments on the code, this PR changes 20 files, in opposite to previous PR #954 which modifies 31 files. Some of them are related with NGSIv1 tests but not all of them. Could you elaborate why? The files not covered in this PR but with changes in 954 and are not NGSv1 related are:
|
overpassed by #1375 (comment) |
Added code for iot/configGroups (#752)