From 288ff9d62d841df44c2e0144f1365d13cecd65e6 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Mon, 23 May 2022 13:18:57 +0200 Subject: [PATCH 01/18] 1.14.0-next -> 1.15.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 869de96..f5dcd93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fiware-pep-steelskin", "description": "FIWARE Policy Enforcement Point", - "version": "1.15.0", + "version": "1.15.0-next", "homepage": "https://github.com/telefonicaid/fiware-pep-steelskin", "author": { "name": "Daniel Moran", From 11f222034feb7d015a7f526095f088c6846aeb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 13 Jun 2022 15:39:55 +0200 Subject: [PATCH 02/18] FIX upgrade NodeJS version from 14-slim to 16-slim in Dockerfile --- CHANGES_NEXT_RELEASE | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 8b13789..adaaa52 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1 @@ - +- Upgrade NodeJS version from 14-slim to 16-slim in Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index 432c109..aef22d9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ # For those usages not covered by the GNU Affero General Public License # please contact with: [sc_support at telefonica dot com] -ARG NODE_VERSION=14-slim +ARG NODE_VERSION=16-slim FROM node:${NODE_VERSION} ARG GITHUB_ACCOUNT=telefonicaid ARG GITHUB_REPOSITORY=fiware-pep-steelskin From ac010e7bf915bfb1008813e78c74645e0808316b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 20:18:11 +0000 Subject: [PATCH 03/18] Bump flask from 1.0.0 to 2.3.2 in /test/acceptance Bumps [flask](https://github.com/pallets/flask) from 1.0.0 to 2.3.2. - [Release notes](https://github.com/pallets/flask/releases) - [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/flask/compare/1.0...2.3.2) --- updated-dependencies: - dependency-name: flask dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- test/acceptance/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/requirements.txt b/test/acceptance/requirements.txt index 882951e..55d1876 100644 --- a/test/acceptance/requirements.txt +++ b/test/acceptance/requirements.txt @@ -1,6 +1,6 @@ lettuce==0.2.20 fabric==1.10.0 -flask==1.0.0 # blindly changing from 0.12.3 due to a github vulnerability warning, not yet tested... +flask==2.3.2 # blindly changing from 0.12.3 due to a github vulnerability warning, not yet tested... requests==2.20.0 colorama==0.2.5 paramiko==2.10.1 # blindly changing from 2.0.9 due to a github vulnerability warning, not yet tested... From 86e5528148c5f308f94d50b51554420643f7d20b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 21:34:07 +0000 Subject: [PATCH 04/18] Bump requests from 2.20.0 to 2.31.0 in /test/acceptance Bumps [requests](https://github.com/psf/requests) from 2.20.0 to 2.31.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.20.0...v2.31.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- test/acceptance/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/requirements.txt b/test/acceptance/requirements.txt index 55d1876..69cfc1b 100644 --- a/test/acceptance/requirements.txt +++ b/test/acceptance/requirements.txt @@ -1,7 +1,7 @@ lettuce==0.2.20 fabric==1.10.0 flask==2.3.2 # blindly changing from 0.12.3 due to a github vulnerability warning, not yet tested... -requests==2.20.0 +requests==2.31.0 colorama==0.2.5 paramiko==2.10.1 # blindly changing from 2.0.9 due to a github vulnerability warning, not yet tested... psutil==5.6.6 From fde272dd6a58aacb0a717f1318bc6519ceb55614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Tue, 23 May 2023 09:32:09 +0200 Subject: [PATCH 05/18] Update test/acceptance/requirements.txt --- test/acceptance/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/requirements.txt b/test/acceptance/requirements.txt index 69cfc1b..0d18ef7 100644 --- a/test/acceptance/requirements.txt +++ b/test/acceptance/requirements.txt @@ -1,7 +1,7 @@ lettuce==0.2.20 fabric==1.10.0 flask==2.3.2 # blindly changing from 0.12.3 due to a github vulnerability warning, not yet tested... -requests==2.31.0 +requests==2.31.0 # blindly change from 2.20.0 (test/acceptance is no longer in use) colorama==0.2.5 paramiko==2.10.1 # blindly changing from 2.0.9 due to a github vulnerability warning, not yet tested... psutil==5.6.6 From 7fb3636b89242575885f39152264c31113e1aebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:46:00 +0200 Subject: [PATCH 06/18] REMOVE operations no longer supported by Orion in orionUrls.js --- lib/plugins/orionUrls.js | 62 ++++------------------------------------ 1 file changed, 5 insertions(+), 57 deletions(-) diff --git a/lib/plugins/orionUrls.js b/lib/plugins/orionUrls.js index f5a7caa..50ebf5e 100644 --- a/lib/plugins/orionUrls.js +++ b/lib/plugins/orionUrls.js @@ -34,64 +34,12 @@ * this table will fail). */ module.exports = [ - /* Standard NGSI operations */ + /* Legacy NGSI operations (to be removed soon) */ + /* Note POST /(v1|ngsi10)/updateContext is not included here, as it is processed in an special way in orionPlugin.js */ ['POST', /\/(v1|ngsi10)\/querycontext$/, 'read'], - ['POST', /\/(v1|ngsi10)\/subscribecontext$/, 'subscribe'], - ['POST', /\/(v1|ngsi10)\/updatecontextsubscription$/, 'subscribe'], - ['POST', /\/(v1|ngsi10)\/unsubscribecontext$/, 'subscribe'], - ['POST', /\/(v1\/registry|ngsi9)\/registercontext$/, 'register'], - ['POST', /\/(v1\/registry|ngsi9)\/discovercontextavailability$/, 'discover'], - ['POST', /\/v1\/contexttypes$/, 'read'], - - - /* "Classic" NGSI9 operations */ - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributeDomains\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributeDomains\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+/, 'register'], - /* "Classic" NGSI10 operations */ - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'read'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'create'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'update'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'read'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'update'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributeDomains\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+/, 'read'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+/, 'update'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+/, 'create'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributes\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'read'], - ['POST', /^\/(ngsi10|v1)\/contextsubscriptions$/, 'subscribe'], - ['PUT', /^\/(ngsi10|v1)\/contextsubscriptions\/.+/, 'subscribe'], - ['DELETE', /^\/(ngsi10|v1)\/contextsubscriptions\/.+/, 'subscribe'], - /* New operations in v1/ (note that they don't use the "ngsi10" alternative in the pattern) */ - ['GET', /^\/v1\/contextentities/, 'read'], - ['POST', /^\/v1\/contextentities/, 'create'], - ['GET', /^\/v1\/contextsubscriptions/, 'read'], - ['GET', /^\/v1\/contextsubscriptions\/.+/, 'read'], - ['GET', /^\/v1\/contexttypes/, 'read'], - ['GET', /^\/v1\/contexttypes\/.+/, 'read'], + ['GET', /^\/v1\/contextentities\/.+\/attributes\/.+/, 'read'], + ['PUT', /^\/v1\/contextentities\/.+/, 'update'], + ['DELETE', /^\/v1\/contextentities\/.+/, 'delete'], /* V2 Operations */ ['POST', /^\/v2\/op\/query$/, 'read'], From 91934f858159cef99eb6c80b41648b94480973e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:46:45 +0200 Subject: [PATCH 07/18] ADD entry to Changelog --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index adaaa52..4b5410e 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ +- Remove: operations no longer supported in CB API (aligned with Orion 3.10.1) - Upgrade NodeJS version from 14-slim to 16-slim in Dockerfile From 0f6734fa61550f4c26f7755c7b3b7ce5bbef50f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:49:41 +0200 Subject: [PATCH 08/18] FIX lint --- lib/plugins/orionUrls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/orionUrls.js b/lib/plugins/orionUrls.js index 50ebf5e..58e374a 100644 --- a/lib/plugins/orionUrls.js +++ b/lib/plugins/orionUrls.js @@ -35,7 +35,8 @@ */ module.exports = [ /* Legacy NGSI operations (to be removed soon) */ - /* Note POST /(v1|ngsi10)/updateContext is not included here, as it is processed in an special way in orionPlugin.js */ + /* Note POST /(v1|ngsi10)/updateContext is not included here, + /* as it is processed in an special way in orionPlugin.js */ ['POST', /\/(v1|ngsi10)\/querycontext$/, 'read'], ['GET', /^\/v1\/contextentities\/.+\/attributes\/.+/, 'read'], ['PUT', /^\/v1\/contextentities\/.+/, 'update'], From 8eae40bde6059a8dd58cb6cfba9f131905c2ff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:54:02 +0200 Subject: [PATCH 09/18] REMOVE operations in extract_cb_convenience_test.js --- test/unit/extract_cb_convenience_test.js | 99 ------------------------ 1 file changed, 99 deletions(-) diff --git a/test/unit/extract_cb_convenience_test.js b/test/unit/extract_cb_convenience_test.js index f4ad2cb..9b1db1d 100644 --- a/test/unit/extract_cb_convenience_test.js +++ b/test/unit/extract_cb_convenience_test.js @@ -35,105 +35,6 @@ var serverMocks = require('../tools/serverMocks'), convenienceOperations; convenienceOperations = [ - /* "Classic" NGSI9 operations */ - ['GET', '/ngsi9/contextEntities/TestedEntityId001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001', 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001', 'register'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributes/TestedAttributeName001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes/TestedAttributeName001', - 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributes/TestedAttributeName001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes/TestedAttributeName001', - 'register'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributeDomains/TestedDomainName001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributeDomains/TestedDomainName001', - 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributeDomains/TestedDomainName001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributeDomains/TestedDomainName001', - 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001', 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'register'], - - /* "Classic" NGSI10 operations */ - ['GET', '/ngsi10/contextEntities/TestedEntityId002', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'read'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'update'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002', 'create'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'create'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002', 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'read'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'create'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'create'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'update'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'read'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'update'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', - 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributeDomains/TestedDomainName001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributeDomains/TestedDomainName001', - 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001', 'read'], - ['GET', '/v1/contextEntities/{EntityID}', 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'read'], - ['POST', '/ngsi10/contextSubscriptions', 'subscribe'], - ['PUT', '/ngsi10/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['DELETE', '/ngsi10/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - - /* Testing a subset of "classic" operations in v1/ prefix (we don't need to be exahustive) */ - ['PUT', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['DELETE', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['PUT', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['GET', '/v1/registry/contextEntityTypes/TestedTypeName001', 'discover'], - ['POST', '/v1/registry/contextEntityTypes/TestedTypeName001', 'register'], - - /* New operations in v1/ */ - ['GET', '/v1/contextEntities', 'read'], - ['POST', '/v1/contextEntities', 'create'], - ['GET', '/v1/contextSubscriptions', 'read'], - ['GET', '/v1/contextSubscriptions/sub001', 'read'], - ['GET', '/v1/contextTypes', 'read'], - ['GET', '/v1/contextTypes/typeOfEntity001', 'read'], - - /* NGSI Operations with query params */ - ['GET', '/v1/contextSubscriptions?details=on&limit=15&offset=0', 'read'], - /* V2 Operations */ ['GET', '/v2', 'read'], ['GET', '/v2/entities', 'read'], From 6374d857ec026ffba8e8f6315577eb7501e2f98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:56:00 +0200 Subject: [PATCH 10/18] REMOVE operations and XML cases in extract_csb_actions_test.js --- test/unit/extract_csb_actions_test.js | 183 -------------------------- 1 file changed, 183 deletions(-) diff --git a/test/unit/extract_csb_actions_test.js b/test/unit/extract_csb_actions_test.js index 561e35f..3907a42 100644 --- a/test/unit/extract_csb_actions_test.js +++ b/test/unit/extract_csb_actions_test.js @@ -111,11 +111,6 @@ describe('Extract Context Broker action from request', function() { var standardOperation = [ ['/NGSI10/queryContext', 'read'], - ['/ngsi10/subscribeContext', 'subscribe'], - ['/ngsi10/updateContextSubscription', 'subscribe'], - ['/ngsi10/unsubscribeContext', 'subscribe'], - ['/ngsi9/registerContext', 'register'], - ['/ngsi9/discoverContextAvailability', 'discover'], ['/v2/op/query', 'read'], ['/v1/queryContext', 'read'], ['/v1/contextTypes', 'read'], @@ -255,67 +250,6 @@ describe('Extract Context Broker action from request', function() { it('should add the action attribute with value "delete" to the request', testAction('delete', options)); }); - describe('When a create action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityCreation.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "create" to the request', testAction('create', options)); - }); - - describe('When a update action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityUpdate.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "update" to the request', testAction('update', options)); - }); - describe('When a delete action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityDelete.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "delete" to the request', testAction('delete', options)); - }); describe('When a update action arrives with JSON payload without the \'updateAction\' attribute', function() { var options = { @@ -344,32 +278,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a update action arrives with XML payload without the \'updateAction\' attribute', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entityUpdateNoAttribute.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with an Unauthorized code', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); - describe('When a update action arrives with a URL that it\'s not recognized by the system', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/falsePath', @@ -421,31 +329,6 @@ describe('Extract Context Broker action from request', function() { }); }); }); - describe('When an update action comes with an unknown action in an XML format', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entityUnknownOperation.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with a 400', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); describe('When a request arrives with an unknown body type', function() { var options = { @@ -473,32 +356,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a request arrives with an XML body with a wrong syntax', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entitySyntaxError.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with a 400 error', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); - describe('When a request arrives with a JSON body with a wrong syntax', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', @@ -525,46 +382,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a request arrives with a valid XML payload to the proxy', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityUpdate.xml', true) - }; - - beforeEach(function(done) { - async.series([ - async.apply(serverMocks.mockPath, '/v3/role_assignments', mockOAuthApp), - async.apply(serverMocks.mockPath, '/v3/auth/tokens', mockOAuthApp), - async.apply(serverMocks.mockPath, '/v3/projects', mockOAuthApp), - async.apply(serverMocks.mockPath, '/pdp/v3', mockAccessApp), - async.apply(serverMocks.mockPath, '/NGSI10/updateContext', mockApp) - ], done); - }); - - it('should proxy the request to the target URL', function(done) { - var mockExecuted = false; - - mockApp.handler = function(req, res) { - req.rawBody.replace(/\n/g, '').should.match(/.*<\/updateContextRequest>/); - mockExecuted = true; - res.status(200).json({}); - }; - - request(options, function(error, response, body) { - mockExecuted.should.equal(true); - done(); - }); - }); - }); - describe('When a request arrives with a valid JSON payload to the proxy', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', From 4d6ce0a91ca0265621cccc8963bbfc409f46c337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:59:30 +0200 Subject: [PATCH 11/18] FIX remove operations in extract_csb_actions_test.js --- test/unit/extract_csb_actions_test.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/unit/extract_csb_actions_test.js b/test/unit/extract_csb_actions_test.js index 3907a42..e0ee79c 100644 --- a/test/unit/extract_csb_actions_test.js +++ b/test/unit/extract_csb_actions_test.js @@ -112,13 +112,7 @@ describe('Extract Context Broker action from request', function() { var standardOperation = [ ['/NGSI10/queryContext', 'read'], ['/v2/op/query', 'read'], - ['/v1/queryContext', 'read'], - ['/v1/contextTypes', 'read'], - ['/v1/subscribeContext', 'subscribe'], - ['/v1/updateContextSubscription', 'subscribe'], - ['/v1/unsubscribeContext', 'subscribe'], - ['/v1/registry/registerContext', 'register'], - ['/v1/registry/discoverContextAvailability', 'discover'] + ['/v1/queryContext', 'read'] ]; function testStandardOperation(url, action) { From 464e9ec07e1e6e1410d2dcb168c64a722593449e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 12:08:46 +0200 Subject: [PATCH 12/18] FIX op in querystring_test.js --- test/unit/querystring_test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/querystring_test.js b/test/unit/querystring_test.js index dc2712f..76f33ed 100644 --- a/test/unit/querystring_test.js +++ b/test/unit/querystring_test.js @@ -94,7 +94,7 @@ describe('Proxy querystring behavior', function() { describe('When a request to the CB arrives to the proxy with a querystring', function() { var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/v1/contextEntities', + uri: 'http://localhost:' + config.resource.proxy.port + '/v2/entities', method: 'GET', headers: { 'Accept': 'application/json', @@ -112,7 +112,7 @@ describe('Proxy querystring behavior', function() { beforeEach(function(done) { async.series([ async.apply(serverMocks.mockPath, '/pdp/v3', mockAccessApp), - async.apply(serverMocks.mockPath, '/v1/contextentities', mockTargetApp) + async.apply(serverMocks.mockPath, '/v2/entities', mockTargetApp) ], done); }); From b469bf992c331b14a2c10f6532c32fce5c7ea0bd Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 24 Jul 2023 11:36:50 +0200 Subject: [PATCH 13/18] Add webhook bash script --- .github/fiware/image-clone.sh | 31 +++++++++++++++++++++++++++++++ README.md | 7 ++++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100755 .github/fiware/image-clone.sh diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh new file mode 100755 index 0000000..5bc1296 --- /dev/null +++ b/.github/fiware/image-clone.sh @@ -0,0 +1,31 @@ +set -e + +SOURCE="telefonicaiot/fiware-pep-steelskin" +DOCKER_TARGET="fiware/pep-steelskin" +QUAY_TARGET="quay.io/fiware/pep-steelskin" + +# DOCKER_TARGET="fiware/$(basename $(git rev-parse --show-toplevel))" +# QUAY_TARGET="quay.io/fiware/$(basename $(git rev-parse --show-toplevel))" + +VERSION=$(git describe --exclude 'FIWARE*' --tags $(git rev-list --tags --max-count=1)) + +function clone { + echo 'cloning from '"$1 $2"' to '"$3" + docker pull -q "$1":"$2" + docker tag "$1":"$2" "$3":"$2" + + if ! [ -z "$4" ]; then + echo 'pushing '"$1 $2"' to latest' + docker push -q "$3":latest + fi +} + +for i in "$@" ; do + if [[ $i == "docker" ]]; then + clone "$SOURCE" "$VERSION" "$DOCKER_TARGET" true + fi + if [[ $i == "quay" ]]; then + clone "$SOURCE" "$VERSION" "$QUAY_TARGET" true + fi + echo "" +done \ No newline at end of file diff --git a/README.md b/README.md index 949002e..efbccd9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![FIWARE Security](https://nexus.lab.fiware.org/static/badges/chapters/security.svg)](https://www.fiware.org/developers/catalogue/) [![License: APGL](https://img.shields.io/github/license/telefonicaid/fiware-pep-steelskin.svg)](https://opensource.org/licenses/AGPL-3.0) +[![Docker badge](https://img.shields.io/badge/quay.io-fiware%2Fpep--steelskin-grey?logo=red%20hat&labelColor=EE0000)](https://quay.io/repository/fiware/pep-steelskin)
[![CI](https://github.com/telefonicaid/fiware-pep-steelskin/workflows/CI/badge.svg)](https://github.com/telefonicaid/fiware-pep-steelskin/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/github/telefonicaid/fiware-pep-steelskin/badge.svg?branch=master)](https://coveralls.io/github/telefonicaid/fiware-pep-steelskin?branch=master) @@ -45,7 +46,7 @@ Three other documents provide further information about the PEP Proxy: ### Dependencies The PEP Proxy is standard Node.js app and doesn't require more dependencies than the Node.js interpreter (0.10 or higher) and the NPM package utility. For RPM installations using Yum, those dependencies should be automatically installed. -### Without RPM Packages +### Without RPM Packages Just checkout this directory and install the Node.js dependencies using: ``` @@ -399,7 +400,7 @@ For testing purposes it might be interesting to launch the process directly with Take into account that when the process is executed manually the system configuration for the script (in /etc/sysconfig/pepProxy) is not loaded and the default configuration (in /opt/pepProxy/config.js) is used. -#### Stop service +#### Stop service To stop the service, use either the service command: ``` service pepProxy stop @@ -710,7 +711,7 @@ An up-to-date list of the convenience operations can be found [here](https://doc | GET | /v1/contextTypes | R | | GET | /v1/contextTypes{typename} | R | -#### NGSIv2 +#### NGSIv2 | Method | Path | Action | | ------ |:--------------------------------------------------------------------------------------- | ---:| | GET | /v2 | R | From dafdd482371ca6b8c0e3222a5e9547a4612e21ac Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 24 Jul 2023 12:04:57 +0200 Subject: [PATCH 14/18] Update image-clone.sh --- .github/fiware/image-clone.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh index 5bc1296..46d5d29 100755 --- a/.github/fiware/image-clone.sh +++ b/.github/fiware/image-clone.sh @@ -16,6 +16,7 @@ function clone { if ! [ -z "$4" ]; then echo 'pushing '"$1 $2"' to latest' + docker tag "$1":"$2" "$3":latest docker push -q "$3":latest fi } @@ -28,4 +29,4 @@ for i in "$@" ; do clone "$SOURCE" "$VERSION" "$QUAY_TARGET" true fi echo "" -done \ No newline at end of file +done From 2c928bef6a3f556fdc4a6fd28c27fab34ef78cc6 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 3 Aug 2023 20:04:07 +0200 Subject: [PATCH 15/18] Add push --- .github/fiware/image-clone.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh index 46d5d29..e682546 100755 --- a/.github/fiware/image-clone.sh +++ b/.github/fiware/image-clone.sh @@ -13,6 +13,7 @@ function clone { echo 'cloning from '"$1 $2"' to '"$3" docker pull -q "$1":"$2" docker tag "$1":"$2" "$3":"$2" + docker push -q "$3":"$2" if ! [ -z "$4" ]; then echo 'pushing '"$1 $2"' to latest' From d9d61831863a7ec24b13470d38e850f5f6f25c8e Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 11 Aug 2023 13:07:35 +0200 Subject: [PATCH 16/18] Add clean --- .github/fiware/image-clone.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh index e682546..6f2dec4 100755 --- a/.github/fiware/image-clone.sh +++ b/.github/fiware/image-clone.sh @@ -31,3 +31,9 @@ for i in "$@" ; do fi echo "" done + +for i in "$@" ; do + if [[ $i == "clean" ]]; then + docker rmi -f $(docker images -a -q) | true + fi +done From 64ccb90357c39b645c6e9a93fce4ebd5014d22e9 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 15 Sep 2023 11:50:39 +0200 Subject: [PATCH 17/18] Delete .github/fiware/image-clone.sh --- .github/fiware/image-clone.sh | 39 ----------------------------------- 1 file changed, 39 deletions(-) delete mode 100755 .github/fiware/image-clone.sh diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh deleted file mode 100755 index 6f2dec4..0000000 --- a/.github/fiware/image-clone.sh +++ /dev/null @@ -1,39 +0,0 @@ -set -e - -SOURCE="telefonicaiot/fiware-pep-steelskin" -DOCKER_TARGET="fiware/pep-steelskin" -QUAY_TARGET="quay.io/fiware/pep-steelskin" - -# DOCKER_TARGET="fiware/$(basename $(git rev-parse --show-toplevel))" -# QUAY_TARGET="quay.io/fiware/$(basename $(git rev-parse --show-toplevel))" - -VERSION=$(git describe --exclude 'FIWARE*' --tags $(git rev-list --tags --max-count=1)) - -function clone { - echo 'cloning from '"$1 $2"' to '"$3" - docker pull -q "$1":"$2" - docker tag "$1":"$2" "$3":"$2" - docker push -q "$3":"$2" - - if ! [ -z "$4" ]; then - echo 'pushing '"$1 $2"' to latest' - docker tag "$1":"$2" "$3":latest - docker push -q "$3":latest - fi -} - -for i in "$@" ; do - if [[ $i == "docker" ]]; then - clone "$SOURCE" "$VERSION" "$DOCKER_TARGET" true - fi - if [[ $i == "quay" ]]; then - clone "$SOURCE" "$VERSION" "$QUAY_TARGET" true - fi - echo "" -done - -for i in "$@" ; do - if [[ $i == "clean" ]]; then - docker rmi -f $(docker images -a -q) | true - fi -done From cf4d1d7b35a003f399c3295933678da6458afc42 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 15 Sep 2023 13:38:31 +0200 Subject: [PATCH 18/18] Update README.md Co-authored-by: mapedraza <40356341+mapedraza@users.noreply.github.com> --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index efbccd9..a087903 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![FIWARE Security](https://nexus.lab.fiware.org/static/badges/chapters/security.svg)](https://www.fiware.org/developers/catalogue/) [![License: APGL](https://img.shields.io/github/license/telefonicaid/fiware-pep-steelskin.svg)](https://opensource.org/licenses/AGPL-3.0) -[![Docker badge](https://img.shields.io/badge/quay.io-fiware%2Fpep--steelskin-grey?logo=red%20hat&labelColor=EE0000)](https://quay.io/repository/fiware/pep-steelskin) +[![Quay badge](https://img.shields.io/badge/quay.io-fiware%2Fpep--steelskin-grey?logo=red%20hat&labelColor=EE0000)](https://quay.io/repository/fiware/pep-steelskin) +[![Docker badge](https://img.shields.io/badge/docker-telefonicaiot%2Ffiware--pep--steelskin-blue?logo=docker)](https://hub.docker.com/r/telefonicaiot/fiware-pep-steelskin)
[![CI](https://github.com/telefonicaid/fiware-pep-steelskin/workflows/CI/badge.svg)](https://github.com/telefonicaid/fiware-pep-steelskin/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/github/telefonicaid/fiware-pep-steelskin/badge.svg?branch=master)](https://coveralls.io/github/telefonicaid/fiware-pep-steelskin?branch=master)