From 5e50446315661ed08f2c5e47089bf464682abf33 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 10 Apr 2020 18:38:13 +0200 Subject: [PATCH] feature: support ngsi-ld context broker #82 --- config.js | 8 +- package.json | 2 +- .../deviceProvisioningNoMapping.json | 2 +- .../deviceProvisioningPluginMapping.json | 2 +- .../deviceProvisioningRightMapping.json | 2 +- .../expectedDataUpdatePluginRequest.json | 76 ++++---- .../expectedDataUpdateRequest.json | 100 +++++------ .../expectedProvisioningPluginRequest.json | 77 ++++---- .../expectedProvisioningRequest.json | 113 ++++++------ .../expectedDeviceRegisterRequest.json | 113 ++++++------ .../expectedDeviceUpdateDataRequest.json | 100 +++++------ test/testConfig.js | 4 +- test/tools/ngsiUtils.js | 168 ++++++++++++++++++ test/unit/deviceProvisioning-test.js | 7 +- test/unit/ngsi-communication-test.js | 12 +- test/unit/plugin-config-test.js | 8 +- 16 files changed, 465 insertions(+), 329 deletions(-) create mode 100644 test/tools/ngsiUtils.js diff --git a/config.js b/config.js index 3b5b69a..cd7a78d 100644 --- a/config.js +++ b/config.js @@ -58,7 +58,13 @@ config.iota = { /** * Port where the Context Broker is listening. */ - port: '1026' + port: '1026', + + /** + * Version of NGSI + */ + ngsiVersion: 'ld', + jsonLdContext: 'https://schema.lab.fiware.org/ld/context.jsonld' }, /** diff --git a/package.json b/package.json index 8dbfe8f..9801d35 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "command-node": "0.1.1", "request": "2.88.0", "async": "1.5.2", - "iotagent-node-lib": "git://github.com/telefonicaid/iotagent-node-lib.git#master", + "iotagent-node-lib": "git://github.com/telefonicaid/iotagent-node-lib.git#feature/842_ngsi_ld", "express": "4.16.4", "body-parser": "1.18.3", "logops": "2.1.0" diff --git a/test/examples/deviceProvisioning/deviceProvisioningNoMapping.json b/test/examples/deviceProvisioning/deviceProvisioningNoMapping.json index 26df6f3..40ba8c7 100644 --- a/test/examples/deviceProvisioning/deviceProvisioningNoMapping.json +++ b/test/examples/deviceProvisioning/deviceProvisioningNoMapping.json @@ -6,7 +6,7 @@ "service" : "dumbMordor", "service_path": "/deserts", "entity_name": "TheLastLight", - "entity_type": "SIGFOX", + "entity_type": "Device", "timezone": "America/Santiago", "attributes": [], "lazy": [], diff --git a/test/examples/deviceProvisioning/deviceProvisioningPluginMapping.json b/test/examples/deviceProvisioning/deviceProvisioningPluginMapping.json index fe85e9a..ad92cf8 100644 --- a/test/examples/deviceProvisioning/deviceProvisioningPluginMapping.json +++ b/test/examples/deviceProvisioning/deviceProvisioningPluginMapping.json @@ -6,7 +6,7 @@ "service" : "dumbMordor", "service_path": "/deserts", "entity_name": "sigApp3", - "entity_type": "SIGFOX", + "entity_type": "Device", "timezone": "America/Santiago", "attributes": [ { diff --git a/test/examples/deviceProvisioning/deviceProvisioningRightMapping.json b/test/examples/deviceProvisioning/deviceProvisioningRightMapping.json index 6e90df7..e6a027a 100644 --- a/test/examples/deviceProvisioning/deviceProvisioningRightMapping.json +++ b/test/examples/deviceProvisioning/deviceProvisioningRightMapping.json @@ -4,7 +4,7 @@ "device_id": "sigApp2", "protocol": "SIGFOX", "entity_name": "sigApp2", - "entity_type": "SIGFOX", + "entity_type": "Device", "timezone": "America/Santiago", "attributes": [ { diff --git a/test/examples/deviceProvisioning/expectedDataUpdatePluginRequest.json b/test/examples/deviceProvisioning/expectedDataUpdatePluginRequest.json index 5812b30..375fc03 100644 --- a/test/examples/deviceProvisioning/expectedDataUpdatePluginRequest.json +++ b/test/examples/deviceProvisioning/expectedDataUpdatePluginRequest.json @@ -1,42 +1,34 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "sigApp3", - "attributes": [ - { - "name": "time", - "type": "String", - "value": "1430909015" - }, - { - "name": "statin", - "type": "String", - "value": "0A5F" - }, - { - "name": "lng", - "type": "String", - "value": "-4" - }, - { - "name": "lat", - "type": "String", - "value": "41" - }, - { - "name": "campo1", - "type": "Integer", - "value": "valor1" - }, - { - "name": "campo2", - "type": "Integer", - "value": 64 - } - ] - } - ], - "updateAction": "UPDATE" -} +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "time": { + "type": "Property", + "value": "1430909015" + }, + "statin": { + "type": "Property", + "value": "0A5F" + }, + "lng": { + "type": "Property", + "value": "-4" + }, + "lat": { + "type": "Property", + "value": "41" + }, + "campo1": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "campo2": { + "type": "Property", + "value": 64 + }, + "id": "urn:ngsi-ld:Device:sigApp3", + "type": "Device" + } + ] diff --git a/test/examples/deviceProvisioning/expectedDataUpdateRequest.json b/test/examples/deviceProvisioning/expectedDataUpdateRequest.json index 523bca8..6a7c944 100644 --- a/test/examples/deviceProvisioning/expectedDataUpdateRequest.json +++ b/test/examples/deviceProvisioning/expectedDataUpdateRequest.json @@ -1,57 +1,43 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "sigApp2", - "attributes": [ - { - "name": "time", - "type": "String", - "value": "1430909015" - }, - { - "name": "statin", - "type": "String", - "value": "0A5F" - }, - { - "name": "lng", - "type": "String", - "value": "-4" - }, - { - "name": "lat", - "type": "String", - "value": "41" - }, - { - "name": "theCounter", - "type": "Integer", - "value": 2 - }, - { - "name": "theParam1", - "type": "Integer", - "value": 0 - }, - { - "name": "param2", - "type": "Integer", - "value": 0 - }, - { - "name": "tempDegreesCelsius", - "type": "Integer", - "value": 35 - }, - { - "name": "voltage", - "type": "Integer", - "value": 3183 - } - ] - } - ], - "updateAction": "UPDATE" -} \ No newline at end of file +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "time": { + "type": "Property", + "value": "1430909015" + }, + "statin": { + "type": "Property", + "value": "0A5F" + }, + "lng": { + "type": "Property", + "value": "-4" + }, + "lat": { + "type": "Property", + "value": "41" + }, + "theCounter": { + "type": "Property", + "value": 2 + }, + "theParam1": { + "type": "Property", + "value": 0 + }, + "param2": { + "type": "Property", + "value": 0 + }, + "tempDegreesCelsius": { + "type": "Property", + "value": 35 + }, + "voltage": { + "type": "Property", + "value": 3183 + }, + "id": "urn:ngsi-ld:Device:sigApp2", + "type": "Device" + } +] diff --git a/test/examples/deviceProvisioning/expectedProvisioningPluginRequest.json b/test/examples/deviceProvisioning/expectedProvisioningPluginRequest.json index cf0326f..475ff0a 100644 --- a/test/examples/deviceProvisioning/expectedProvisioningPluginRequest.json +++ b/test/examples/deviceProvisioning/expectedProvisioningPluginRequest.json @@ -1,42 +1,37 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "sigApp3", - "attributes": [ - { - "name": "time", - "type": "String", - "value": " " - }, - { - "name": "statin", - "type": "String", - "value": " " - }, - { - "name": "lng", - "type": "String", - "value": " " - }, - { - "name": "lat", - "type": "String", - "value": " " - }, - { - "name": "campo1", - "type": "Integer", - "value": " " - }, - { - "name": "campo2", - "type": "Integer", - "value": " " - } - ] +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "id": "urn:ngsi-ld:Device:sigApp3", + "type": "Device", + "time": { + "type": "Property", + "value": " " + }, + "statin": { + "type": "Property", + "value": " " + }, + "lng": { + "type": "Property", + "value": " " + }, + "lat": { + "type": "Property", + "value": " " + }, + "campo1": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "campo2": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } } - ], - "updateAction": "APPEND" -} \ No newline at end of file + } + ] diff --git a/test/examples/deviceProvisioning/expectedProvisioningRequest.json b/test/examples/deviceProvisioning/expectedProvisioningRequest.json index b15f268..44d1512 100644 --- a/test/examples/deviceProvisioning/expectedProvisioningRequest.json +++ b/test/examples/deviceProvisioning/expectedProvisioningRequest.json @@ -1,57 +1,58 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "sigApp2", - "attributes": [ - { - "name": "time", - "type": "String", - "value": " " - }, - { - "name": "statin", - "type": "String", - "value": " " - }, - { - "name": "lng", - "type": "String", - "value": " " - }, - { - "name": "lat", - "type": "String", - "value": " " - }, - { - "name": "theCounter", - "type": "Integer", - "value": " " - }, - { - "name": "theParam1", - "type": "Integer", - "value": " " - }, - { - "name": "param2", - "type": "Integer", - "value": " " - }, - { - "name": "tempDegreesCelsius", - "type": "Integer", - "value": " " - }, - { - "name": "voltage", - "type": "Integer", - "value": " " - } - ] +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "id": "urn:ngsi-ld:Device:sigApp2", + "type": "Device", + "time": { + "type": "Property", + "value": " " + }, + "statin": { + "type": "Property", + "value": " " + }, + "lng": { + "type": "Property", + "value": " " + }, + "lat": { + "type": "Property", + "value": " " + }, + "theCounter": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "theParam1": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "param2": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "tempDegreesCelsius": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "voltage": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } } - ], - "updateAction": "APPEND" -} \ No newline at end of file + } + ] diff --git a/test/examples/ngsi-communication/expectedDeviceRegisterRequest.json b/test/examples/ngsi-communication/expectedDeviceRegisterRequest.json index c1d285f..3b68dfc 100644 --- a/test/examples/ngsi-communication/expectedDeviceRegisterRequest.json +++ b/test/examples/ngsi-communication/expectedDeviceRegisterRequest.json @@ -1,57 +1,58 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "SIGFOX:sigApp1", - "attributes": [ - { - "name": "time", - "type": "String", - "value": " " - }, - { - "name": "statin", - "type": "String", - "value": " " - }, - { - "name": "lng", - "type": "String", - "value": " " - }, - { - "name": "lat", - "type": "String", - "value": " " - }, - { - "name": "counter", - "type": "Integer", - "value": " " - }, - { - "name": "param1", - "type": "Integer", - "value": " " - }, - { - "name": "param2", - "type": "Integer", - "value": " " - }, - { - "name": "tempDegreesCelsius", - "type": "Integer", - "value": " " - }, - { - "name": "voltage", - "type": "Integer", - "value": " " - } - ] +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "id": "urn:ngsi-ld:Device:sigApp1", + "type": "Device", + "time": { + "type": "Property", + "value": " " + }, + "statin": { + "type": "Property", + "value": " " + }, + "lng": { + "type": "Property", + "value": " " + }, + "lat": { + "type": "Property", + "value": " " + }, + "counter": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "param1": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "param2": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "tempDegreesCelsius": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } + }, + "voltage": { + "type": "Property", + "value": { + "@type": "Intangible", + "@value": null + } } - ], - "updateAction": "APPEND" -} \ No newline at end of file + } + ] diff --git a/test/examples/ngsi-communication/expectedDeviceUpdateDataRequest.json b/test/examples/ngsi-communication/expectedDeviceUpdateDataRequest.json index b55604e..b842412 100644 --- a/test/examples/ngsi-communication/expectedDeviceUpdateDataRequest.json +++ b/test/examples/ngsi-communication/expectedDeviceUpdateDataRequest.json @@ -1,57 +1,43 @@ -{ - "contextElements": [ - { - "type": "SIGFOX", - "isPattern": "false", - "id": "SIGFOX:sigApp1", - "attributes": [ - { - "name": "time", - "type": "String", - "value": "1430909015" - }, - { - "name": "statin", - "type": "String", - "value": "0A5F" - }, - { - "name": "lng", - "type": "String", - "value": "-4" - }, - { - "name": "lat", - "type": "String", - "value": "41" - }, - { - "name": "counter", - "type": "Integer", - "value": 2 - }, - { - "name": "param1", - "type": "Integer", - "value": 0 - }, - { - "name": "param2", - "type": "Integer", - "value": 0 - }, - { - "name": "tempDegreesCelsius", - "type": "Integer", - "value": 35 - }, - { - "name": "voltage", - "type": "Integer", - "value": 3183 - } - ] - } - ], - "updateAction": "UPDATE" -} +[ + { + "@context": "https://schema.lab.fiware.org/ld/context.jsonld", + "time": { + "type": "Property", + "value": "1430909015" + }, + "statin": { + "type": "Property", + "value": "0A5F" + }, + "lng": { + "type": "Property", + "value": "-4" + }, + "lat": { + "type": "Property", + "value": "41" + }, + "counter": { + "type": "Property", + "value": 2 + }, + "param1": { + "type": "Property", + "value": 0 + }, + "param2": { + "type": "Property", + "value": 0 + }, + "tempDegreesCelsius": { + "type": "Property", + "value": 35 + }, + "voltage": { + "type": "Property", + "value": 3183 + }, + "id": "urn:ngsi-ld:Device:sigApp1", + "type": "Device" + } + ] diff --git a/test/testConfig.js b/test/testConfig.js index c62389b..99c5867 100644 --- a/test/testConfig.js +++ b/test/testConfig.js @@ -31,7 +31,9 @@ config.iota = { logLevel: 'DEBUG', contextBroker: { host: 'localhost', - port: '10026' + port: '10026', + ngsiVersion: 'ld', + jsonLdContext: 'https://schema.lab.fiware.org/ld/context.jsonld' }, server: { port: 4041 diff --git a/test/tools/ngsiUtils.js b/test/tools/ngsiUtils.js new file mode 100644 index 0000000..b980eac --- /dev/null +++ b/test/tools/ngsiUtils.js @@ -0,0 +1,168 @@ +/* + * Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U + * + * This file is part of sigfox-iotagent + * + * sigfox-iotagent is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the License, + * or (at your option) any later version. + * + * sigfox-iotagent is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with sigfox-iotagent. + * If not, seehttp://www.gnu.org/licenses/. + * + * For those usages not covered by the GNU Affero General Public License + * please contact with::[daniel.moranjimenez at telefonica.com] + */ +'use strict'; + +var request = require('request'); + +/** + * Updates the information in a Context Broker entity. + * + * @param {String} host Host where the Context Broker is installed. + * @param {Number} port Port where the Context Broker is listening. + * @param {String} service Service the entity belongs to. + * @param {String} subservice Subservice of the service where the entity was created. + * @param {String} name Id of the entity to query. + * @param {String} type Type of the entity to query. + * @param {Array} attributes List of attributes to retrieve, along with their types and values. + */ +function updateEntity(host, port, service, subservice, name, type, attributes, callback) { + var options = { + url: 'http://' + host + ':' + port + '/v1/updateContext', + method: 'POST', + headers: { + 'fiware-service': service, + 'fiware-servicepath': subservice + }, + json: { + contextElements: [ + { + type: type, + id: name, + isPattern: 'false', + attributes: attributes + } + ], + updateAction: 'UPDATE' + } + }; + + request(options, callback); +} + +/** + * Query the information for a Context Broker entity. + * + * @param {String} host Host where the Context Broker is installed. + * @param {Number} port Port where the Context Broker is listening. + * @param {String} service Service the entity belongs to. + * @param {String} subservice Subservice of the service where the entity was created. + * @param {String} id Id of the entity to query. + * @param {String} type Type of the entity to query. + * @param {Array} attributes List of attributes to retrieve. + */ +function queryEntity(host, port, service, subservice, id, type, attributes, callback) { + var options = { + url: 'http://' + host + ':' + port + '/v1/queryContext', + method: 'POST', + headers: { + 'fiware-service': service, + 'fiware-servicepath': subservice + }, + json: { + entities: [ + { + type: type, + id: id, + isPattern: 'false' + } + ], + attributes: attributes + } + }; + + request(options, callback); +} + +function queryEntityNgsiLD(host, port, service, subservice, id, type, attributes, callback) { + const ngsiLdId = 'urn:ngsi-ld:' + type + ':' + id; + const options = { + url: 'http://' + host + ':' + port + '/ngsi-ld/v1/entities/' + ngsiLdId, + method: 'GET', + headers: { + 'Content-Type': 'application/ld+json', + Accept: 'application/ld+json' + }, + qs: { + attributes: attributes + } + }; + + request(options, callback); +} + +/** + * Get the context providers for a list of attributes of an entity. + * + * @param {String} host Host where the Context Broker is installed. + * @param {Number} port Port where the Context Broker is listening. + * @param {String} service Service the entity belongs to. + * @param {String} subservice Subservice of the service where the entity was created. + * @param {String} id Id of the entity to query. + * @param {String} type Type of the entity to query. + * @param {Array} attributes List of attributes to retrieve. + */ +function discoverContextAvailability(host, port, service, subservice, id, type, attributes, callback) { + var options = { + url: 'http://' + host + ':' + port + '/v1/registry/discoverContextAvailability ', + method: 'POST', + headers: { + 'fiware-service': service, + 'fiware-servicepath': subservice + }, + json: { + entities: [ + { + type: type, + id: id, + isPattern: 'false' + } + ], + attributes: attributes + } + }; + + request(options, callback); +} + +function createClient(host, port, ngsiVersion, service, subservice) { + /*jshint validthis:true */ + + if (ngsiVersion === 'ld') + return { + query: queryEntityNgsiLD.bind(null, host, port, service, subservice), + update: updateEntity.bind(null, host, port, service, subservice), + discover: discoverContextAvailability.bind(null, host, port, service, subservice) + }; + else + return { + query: queryEntity.bind(null, host, port, service, subservice), + update: updateEntity.bind(null, host, port, service, subservice), + discover: discoverContextAvailability.bind(null, host, port, service, subservice) + }; +} + +exports.updateEntity = updateEntity; +exports.queryEntity = queryEntity; +exports.queryLdEntity = queryEntityNgsiLD; +exports.discoverContext = discoverContextAvailability; +exports.create = createClient; diff --git a/test/unit/deviceProvisioning-test.js b/test/unit/deviceProvisioning-test.js index a60c947..492a72d 100644 --- a/test/unit/deviceProvisioning-test.js +++ b/test/unit/deviceProvisioning-test.js @@ -59,7 +59,6 @@ describe('Device and configuration provisioning', function() { it('should fail with a 400 error', function(done) { request(provisioningOpts, function(error, response, body) { - console.log('BODY: ' + body); should.not.exist(error); response.statusCode.should.equal(400); done(); @@ -91,17 +90,17 @@ describe('Device and configuration provisioning', function() { nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( - '/v1/updateContext', + '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/deviceProvisioning/expectedProvisioningRequest.json') ) - .reply(200, {}); + .reply(204); nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/deviceProvisioning/expectedDataUpdateRequest.json') ) - .reply(200, {}); + .reply(204); it('should use the provided provisioning', function(done) { request(provisioningOpts, function(error, response, body) { diff --git a/test/unit/ngsi-communication-test.js b/test/unit/ngsi-communication-test.js index 378f281..3986cf0 100644 --- a/test/unit/ngsi-communication-test.js +++ b/test/unit/ngsi-communication-test.js @@ -35,7 +35,7 @@ var iotAgent = require('../../lib/iotagentCore'), utils = require('../tools/utils'), sigfoxDevice = { id: 'sigApp1', - type: 'SIGFOX', + type: 'Device', commands: [], lazy: [], active: [ @@ -84,10 +84,10 @@ describe('Context Broker communication', function() { beforeEach(function(done) { nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( - '/v1/updateContext', + '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/ngsi-communication/expectedDeviceRegisterRequest.json') ) - .reply(200, {}); + .reply(204); iotAgent.start(config, function() { async.series( @@ -96,7 +96,7 @@ describe('Context Broker communication', function() { mappings.clean, apply( mappings.add, - 'SIGFOX', + 'Device', 'counter::uint:32 param1::uint:32 param2::uint:8 tempDegreesCelsius::uint:8 voltage::uint:16' ), apply(iotAgentLib.register, sigfoxDevice) @@ -128,10 +128,10 @@ describe('Context Broker communication', function() { nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( - '/v1/updateContext', + '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/ngsi-communication/expectedDeviceUpdateDataRequest.json') ) - .reply(200, {}); + .reply(204); it('should answer with a 200 OK', function(done) { request(options, function(error, response, body) { diff --git a/test/unit/plugin-config-test.js b/test/unit/plugin-config-test.js index 6eb12fd..885bf33 100644 --- a/test/unit/plugin-config-test.js +++ b/test/unit/plugin-config-test.js @@ -72,17 +72,17 @@ describe('Plugin configuration test', function() { nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( - '/v1/updateContext', + '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/deviceProvisioning/expectedProvisioningPluginRequest.json') ) - .reply(200, {}); + .reply(204); nock('http://' + config.iota.contextBroker.host + ':' + config.iota.contextBroker.port) .post( - '/v1/updateContext', + '/ngsi-ld/v1/entityOperations/upsert/', utils.readExampleFile('./test/examples/deviceProvisioning/expectedDataUpdatePluginRequest.json') ) - .reply(200, {}); + .reply(204); it('should use the plugin to parse the device responses', function(done) { request(provisioningOpts, function(error, response, body) {