Basic NGSI-LD active measures support#841
Basic NGSI-LD active measures support#841fgalan merged 13 commits intotelefonicaid:feature/842_ngsi_ldfrom
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) No newline at end of file | ||
| Add Null check within executeWithSecurity() to avoid crash (#829) | ||
| Add NGSIv2 metadata support to attributeAlias plugin. |
There was a problem hiding this comment.
Correct - this PR is dependent upon and extends the metadata change.
There was a problem hiding this comment.
PR #839 has been merged. This PR branch should be upgrade, then this diff will disappear.
There was a problem hiding this comment.
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.
| * 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. |
| 'IOTA_POLLING_DAEMON_FREQ', | ||
| 'IOTA_MULTI_CORE' | ||
| 'IOTA_MULTI_CORE', | ||
| 'IOTA_JSON_LD_CONTEXT' |
There was a problem hiding this comment.
New env var should be described in documentation.
There was a problem hiding this comment.
Fixed b41a18a - Minimal Documentation for now.
| @@ -91,7 +91,8 @@ function processEnvironmentVariables() { | |||
| 'IOTA_APPEND_MODE', | |||
There was a problem hiding this comment.
CHANGES_NEXT_RELEASE entry should be provided for this PR.
|
|
||
|
|
||
| /** | ||
| * Creates the initial entity representing the device in the Context Broker using NGSIv2. |
There was a problem hiding this comment.
| * 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. |
|
|
||
|
|
||
| /** | ||
| * Updates the entity representing the device in the Context Broker using NGSIv2. |
There was a problem hiding this comment.
| * 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.
|
|
||
|
|
||
|
|
||
| function convertNGSIv2ToLD(attr){ |
| return obj; | ||
| } | ||
|
|
||
| function formatAsNGSILD(json){ |
lib/services/ngsi/ngsiService.js
Outdated
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Big bunch of empty blank lines... intentional?
There was a problem hiding this comment.
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.
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?
- 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.
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. |
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.
| * 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 |
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.
| * array should comply to the NGSIv2's attribute format. | |
| * array should comply to the NGSI-LD's attribute format. |
|
|
||
|
|
||
| /** | ||
| * Makes a subscription for the given device's entity using NGSIv2, triggered by the given attributes. |
There was a problem hiding this comment.
| * 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.
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. |
| } | ||
| } | ||
|
|
||
| function handleNotificationNgsiLD(req, res, next) { |
There was a problem hiding this comment.
Fixed and Propagated (contextServer isn't the focus of Measures) : a5c650a
| }); | ||
| } | ||
|
|
||
| function queryErrorHandlingNgsiLD(error, req, res, next) { |
| }); | ||
| } | ||
|
|
||
| function updateErrorHandlingNgsiLD(error, req, res, next) { |

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.