Skip to content

Commit

Permalink
Merge pull request #523 from telefonicaid/fgalan-patch-2
Browse files Browse the repository at this point in the history
REMOVE operations no longer supported by Orion in orionUrls.js
  • Loading branch information
AlvaroVega authored Jul 7, 2023
2 parents 158efc0 + 464e9ec commit 24342eb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 348 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -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
63 changes: 6 additions & 57 deletions lib/plugins/orionUrls.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,64 +34,13 @@
* 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'],
Expand Down
99 changes: 0 additions & 99 deletions test/unit/extract_cb_convenience_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
Loading

0 comments on commit 24342eb

Please sign in to comment.