-
Notifications
You must be signed in to change notification settings - Fork 91
Basic NGSI-LD active measures support #841
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
Basic NGSI-LD active measures support #841
Conversation
This can act as a good regression point for NGSI-v2 and NGSI-LD capabilities.
Only forwarded request tests need to be disabled.
- Remove console.error statements. - Allow for disabled tests. - remove unused comparision
The tests cases are copies of the NGSI-v2 tests. The disabled tests are for commands and lazy attributes and therefore will not work until the remaining work is done. Given that the tests are all new, I'm wondering - for the tests only should I: a) Make minimal duplicate and amend changes (as is) |
The command stubs account for the 2% drop in code coverage. |
Fix: Error message when sending measures with unknown/undefined attribute | ||
Add Null check within executeWithSecurity() to avoid crash (#829) | ||
Add Null check within executeWithSecurity() to avoid crash (#829) | ||
Add NGSIv2 metadata support to attributeAlias plugin. |
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.
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.
Correct - this PR is dependent upon and extends the metadata change.
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.
PR #839 has been merged. This PR branch should be upgrade, then this diff will disappear.
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.
I've merge master which should reduce the diff - Fixed with dd81751
Given that these .js files are entirely new, maybe it makes sense to do so. |
Not a big issue from my point of view. The drop will be eventually recovered. |
Fixed (new tests only) 40875e3 - I also corrected the copyrights for the new files to 2020 |
…ngsi-ld-measure Applying telefonicaid#839 and telefonicaid#840 to reduce diff with master
} | ||
|
||
/** | ||
* Creates the response handler for the initial entity creation request using NGSIv2. |
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.
* Creates the response handler for the initial entity creation request using NGSIv2. | |
* Creates the response handler for the initial entity creation request using NGSI-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.
Fixed b41a18a
'IOTA_POLLING_DAEMON_FREQ', | ||
'IOTA_MULTI_CORE' | ||
'IOTA_MULTI_CORE', | ||
'IOTA_JSON_LD_CONTEXT' |
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.
New env var should be described in documentation.
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.
Fixed b41a18a - Minimal Documentation for now.
'IOTA_MONGO_RETRIES', | ||
'IOTA_MONGO_RETRY_TIME', | ||
'IOTA_SINGLE_MODE', | ||
'IOTA_APPEND_MODE', |
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.
CHANGES_NEXT_RELEASE entry should be provided for this PR.
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.
Fixed b41a18a
|
||
|
||
/** | ||
* Creates the initial entity representing the device in the Context Broker using NGSIv2. |
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.
* Creates the initial entity representing the device in the Context Broker using NGSIv2. | |
* Creates the initial entity representing the device in the Context Broker using NGSI-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.
Fixed b41a18a
|
||
|
||
/** | ||
* Updates the entity representing the device in the Context Broker using NGSIv2. |
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.
* Updates the entity representing the device in the Context Broker using NGSIv2. | |
* Updates the entity representing the device in the Context Broker using NGSIv2. |
Three times :) Please, do an overall check for this.
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.
Fixed b41a18a
|
||
|
||
|
||
function convertNGSIv2ToLD(attr){ |
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.
JavaDoc should be provided?
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.
Fixed b41a18a
return obj; | ||
} | ||
|
||
function formatAsNGSILD(json){ |
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.
JavaDoc should be provided?
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.
Fixed b41a18a
lib/services/ngsi/ngsiService.js
Outdated
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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.
Big bunch of empty blank lines... intentional?
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.
Fixed b41a18a (if only this tidying could be done automatically)
"predef": | ||
[ | ||
"describe", "beforeEach", "afterEach", "it" | ||
"describe", "beforeEach", "afterEach", "it", "xdescribe", "xit" |
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.
I have check there are 26 xdescribe() statement and 4 xit() statement added in this PR.
I understand that the work in sucesive PRs within the NGSI-LD line will be re-enable them, isn't it?
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.
Yes
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.
Ok, NTC
- Update CNR - Add Docker ENV to docs - basic LD set-up documentation - amend copy-paste JavaDoc - add missing JavaDoc - remove blank lines.
|
||
|
||
/** | ||
* Sends a Context Provider registration or unregistration request to the Context Broker using NGSIv2. |
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.
Another one ;)
* Sends a Context Provider registration or unregistration request to the Context Broker using NGSIv2. | |
* Sends a Context Provider registration or unregistration request to the Context Broker using NGSI-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.
Fixed a027234
lib/services/ngsi/ngsiService.js
Outdated
|
||
|
||
/** | ||
* Generate an operation handler for NGSIv2-based operations (query and update). The handler takes care of identifiying |
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.
* Generate an operation handler for NGSIv2-based operations (query and update). The handler takes care of identifiying | |
* Generate an operation handler for NGSI-LD-based operations (query and update). The handler takes care of identifiying |
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.
Fixed a027234
lib/services/ngsi/ngsiService.js
Outdated
|
||
/** | ||
* Makes an update in the Device's entity in the context broker, with the values given in the 'attributes' array. This | ||
* array should comply to the NGSIv2's attribute format. |
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.
* array should comply to the NGSIv2's attribute format. | |
* array should comply to the NGSI-LD's attribute format. |
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.
Fixed a027234
|
||
|
||
/** | ||
* Makes a subscription for the given device's entity using NGSIv2, triggered by the given attributes. |
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.
* Makes a subscription for the given device's entity using NGSIv2, triggered by the given attributes. | |
* Makes a subscription for the given device's entity using NGSIv2, triggered by the given attributes. |
Still too many of them... an overall review should be 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.
Fixed a027234
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 one was not fixed at the end (my fault: my suggestion was not correct in my first comment). Now it should be ok:
* Makes a subscription for the given device's entity using NGSIv2, triggered by the given attributes. | |
* Makes a subscription for the given device's entity using NGSI-LD, triggered by the given attributes. |
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.
Fixed c70d9ed
} | ||
} | ||
|
||
function handleNotificationNgsiLD(req, res, next) { |
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.
Missing Javadoc ?
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.
Fixed c70d9ed
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.
Fixed and Propagated (contextServer isn't the focus of Measures) : a5c650a
}); | ||
} | ||
|
||
function queryErrorHandlingNgsiLD(error, req, res, next) { |
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.
Missing JavaDoc?
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.
Fixed c70d9ed
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.
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.
Fixed a5c650a
}); | ||
} | ||
|
||
function updateErrorHandlingNgsiLD(error, req, res, next) { |
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.
Missing JavaDoc?
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.
Fixed c70d9ed
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.
Same here
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.
Fixed: a5c650a
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.
LGTM
This PR offers NGSI-LD support for active measures only under the following configuration.
The existing NGSI-v2 support remains as default under
ngsiVersion: 'v2'
The NGSI-LD support matches the decision trees for NGSI v1/v2 - where necessary a third option has been added and the necessary functionality duplicated.
The set of tests from NGSI v2 have been duplicated and the expectations amended where necessary.
Commands, Subscriptions and Lazy Attribute Support have not been added - disabled test stubs have been created to allow them to be tested once the code base has been updated.