Skip to content

Commit

Permalink
Merge pull request #4563 from telefonicaid/remove/last-ngsiv1-api-ops
Browse files Browse the repository at this point in the history
FIX remove NGSIv1 lasting API ops
  • Loading branch information
mapedraza authored Jun 5, 2024
2 parents 03d3f53 + 5e09b00 commit 769a72a
Show file tree
Hide file tree
Showing 151 changed files with 119 additions and 1,053 deletions.
8 changes: 8 additions & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@
- Hardening: compile code using C++14 standard
- Remove: `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` CLI parameters along with associated env vars, already deprecated in Orion 3.12.0 (use `-dbURI` instead`)
- Remove: legacy subscription format
- Remove: all the remaining NGSIv1 operations
- PUT /v1/contextEntities/{id}
- DELETE /v1/contextEntities/{id}
- GET /v1/contextEntities/{id}/attributes/{name}
- POST /v1/updateContext
- POST /NGSI10/updateContext
- POST /v1/queryContext
- POST /NGSI10/queryContext
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ ENDIF()

SET (ORION_LIBS
common
serviceRoutines
serviceRoutinesV2
serviceRoutines
ngsiNotify
rest # verbName(Verb) from [email protected]; jsonRequestTreat from [email protected];
jsonParse
Expand Down
7 changes: 0 additions & 7 deletions doc/manuals/admin/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,6 @@ time=2020-10-26T15:06:14.642Z | lvl=INFO | corr=c4a3192e-179c-11eb-ac8f-000c29df
If `-logDeprecate` CLI setting is used (or `deprecate` parameter in the [log admin REST API](management_api.md#log-configs-and-trace-levels)) the
following WARN traces are generated:

* NGSIv1 requests (both with and without payload). For instance:

```
time=2023-05-25T14:27:45.958Z | lvl=WARN | corr=513bd10e-fb08-11ed-8ad7-000c29583ca5 | trans=1685024865-125-00000000001 | from=127.0.0.1 | srv=s1 | subsrv=/A | comp=Orion | op=logTracing.cpp[171]:logInfoRequestWithPayload | msg=Deprecated NGSIv1 request received: POST /v1/queryContext, request payload (48 bytes): { "entities": [ { "type": "T1", "id": "E1" } ] }, response code: 200
time=2023-05-25T14:27:46.041Z | lvl=WARN | corr=51490536-fb08-11ed-9782-000c29583ca5 | trans=1685024865-125-00000000002 | from=127.0.0.1 | srv=s1 | subsrv=/A | comp=Orion | op=logTracing.cpp[114]:logInfoRequestWithoutPayload | msg=Deprecated NGSIv1 request received: GET /v1/contextEntities/E, response code: 200
```

* Usages of [`"legacyForwarding": true`](../orion-api.md#registrationprovider)). For instance:

```
Expand Down
1 change: 1 addition & 0 deletions doc/manuals/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ A list of deprecated features and the version in which they were deprecated foll
* `POST /v1/queryContext`
* `POST /NGSI10/queryContext`
* NGSIv1 format in subscription notifications (`notification.atttrsFormat` set to `legacy`) removed in Orion 4.0.0
* Finally, the last remaining NGSIv1 operations where removed in Orion 4.0.0
* `attributes` field in `POST /v2/op/query` is in Orion 1.15.0. It is a combination of `attrs` (to select
which attributes to include in the response to the query) and unary attribute filter in `q` within
`expression` (to return only entities which have these attributes). Use them instead.
Expand Down
121 changes: 67 additions & 54 deletions src/app/contextBroker/orionRestServices.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,65 +33,17 @@ brokerStart CB 0 IPV4 -logDeprecate -statCounters
# Note there is not a "Update registration using legacyForwarding mode"
# as the registrations update operation is not implemented (issue #3007)
#
# 01. Query E1-T1
# 02. GET /v1/contextEntities/E/attributes/A
# 03. Create entity using NGSIv1 and geo:point
# 04. Create entity using NGSIv2 and geo:point
# 05. Create registration using legacyForwarding mode
# 06. Retrieve registrations (which uses legacyForwarding mode)
# 07. Forwarded query using legacyForwarding mode
# 08. Update query using legacyForwarding mode
# 09. Get WARNING trace in logs
# 10. Get statistics and see deprecatedFeatures counters
# 01. Create entity using NGSIv2 and geo:point
# 02. Create registration using legacyForwarding mode
# 03. Retrieve registrations (which uses legacyForwarding mode)
# 04. Forwarded query using legacyForwarding mode
# 05. Update query using legacyForwarding mode
# 06. Get WARNING trace in logs
# 07. Get statistics and see deprecatedFeatures counters
#

echo "01. Query E1-T1"
echo "==============="
payload='{
"entities": [
{
"type": "T1",
"id": "E1"
}
]
}'
orionCurl --url /v1/queryContext --payload "${payload}"
echo
echo


echo "02. GET /v1/contextEntities/E/attributes/A"
echo "=========================================="
orionCurl --url /v1/contextEntities/E/attributes/A
echo
echo


echo "03. Create entity using NGSIv1 and geo:point"
echo "============================================"
payload='{
"contextElements": [
{
"type": "City",
"isPattern": "false",
"id": "Barcelona",
"attributes": [
{
"name": "location",
"type": "geo:point",
"value": "40.418889, -3.691944"
}
]
}
],
"updateAction": "APPEND"
}'
orionCurl --url /v1/updateContext --payload "$payload"
echo
echo


echo "04. Create entity using NGSIv2 and geo:point"
echo "01. Create entity using NGSIv2 and geo:point"
echo "============================================"
payload='{
"id": "Sevilla",
Expand All @@ -106,7 +58,7 @@ echo
echo


echo "05. Create registration using legacyForwarding mode"
echo "02. Create registration using legacyForwarding mode"
echo "==================================================="
payload='{
"dataProvided": {
Expand Down Expand Up @@ -134,21 +86,21 @@ echo
REG_ID=$(echo "$_responseHeaders" | grep Location | awk -F/ '{ print $4 }' | tr -d "\r\n")


echo "06. Retrieve registrations (which uses legacyForwarding mode)"
echo "03. Retrieve registrations (which uses legacyForwarding mode)"
echo "============================================================="
orionCurl --url /v2/registrations
echo
echo


echo "07. Forwarded query using legacyForwarding mode"
echo "04. Forwarded query using legacyForwarding mode"
echo "==============================================="
orionCurl --url /v2/entities/E1/attrs/A1?type=T1
echo
echo


echo "08. Update query using legacyForwarding mode"
echo "05. Update query using legacyForwarding mode"
echo "============================================"
payload='{
"value": 1,
Expand All @@ -159,87 +111,22 @@ echo
echo


echo "09. Get WARNING trace in logs"
echo "06. Get WARNING trace in logs"
echo "============================="
cat /tmp/contextBroker.log | grep 'WARN' | awk -F 'msg=' '{print $2}' | sed -e "s/$REG_ID/REG_ID/g"
echo
echo


echo "10. Get statistics and see deprecatedFeatures counters"
echo "07. Get statistics and see deprecatedFeatures counters"
echo "======================================================"
orionCurl --url /statistics
echo
echo


--REGEXPECT--
01. Query E1-T1
===============
HTTP/1.1 200 OK
Date: REGEX(.*)
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Content-Type: application/json
Content-Length: 70

{
"errorCode": {
"code": "404",
"reasonPhrase": "No context element found"
}
}


02. GET /v1/contextEntities/E/attributes/A
==========================================
HTTP/1.1 200 OK
Date: REGEX(.*)
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Content-Type: application/json
Content-Length: 98

{
"statusCode": {
"code": "404",
"details": "Entity id: /E/",
"reasonPhrase": "No context element found"
}
}


03. Create entity using NGSIv1 and geo:point
============================================
HTTP/1.1 200 OK
Date: REGEX(.*)
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Content-Type: application/json
Content-Length: 207

{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "location",
"type": "geo:point",
"value": ""
}
],
"id": "Barcelona",
"isPattern": "false",
"type": "City"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}


04. Create entity using NGSIv2 and geo:point
01. Create entity using NGSIv2 and geo:point
============================================
HTTP/1.1 201 Created
Date: REGEX(.*)
Expand All @@ -249,7 +136,7 @@ Content-Length: 0



05. Create registration using legacyForwarding mode
02. Create registration using legacyForwarding mode
===================================================
HTTP/1.1 201 Created
Date: REGEX(.*)
Expand All @@ -259,7 +146,7 @@ Content-Length: 0



06. Retrieve registrations (which uses legacyForwarding mode)
03. Retrieve registrations (which uses legacyForwarding mode)
=============================================================
HTTP/1.1 200 OK
Date: REGEX(.*)
Expand Down Expand Up @@ -293,7 +180,7 @@ Content-Length: 233
]


07. Forwarded query using legacyForwarding mode
04. Forwarded query using legacyForwarding mode
===============================================
HTTP/1.1 404 Not Found
Date: REGEX(.*)
Expand All @@ -307,7 +194,7 @@ Content-Length: 95
}


08. Update query using legacyForwarding mode
05. Update query using legacyForwarding mode
============================================
HTTP/1.1 404 Not Found
Date: REGEX(.*)
Expand All @@ -321,12 +208,8 @@ Content-Length: 95
}


09. Get WARNING trace in logs
06. Get WARNING trace in logs
=============================
Deprecated NGSIv1 request received: POST /v1/queryContext, request payload (48 bytes): { "entities": [ { "type": "T1", "id": "E1" } ] }, response code: 200
Deprecated NGSIv1 request received: GET /v1/contextEntities/E/attributes/A, response code: 200
Deprecated usage of geo:point detected in attribute location at entity update, please use geo:json instead
Deprecated NGSIv1 request received: POST /v1/updateContext, request payload (208 bytes): { "contextElements": [ { "type": "City", "isPattern": "false", "id": "Barcelona", "attributes": [ { "name": "location", "type": "geo:point", "value": "40.418889, -3.691944" } ] } ], "updateAction": "APPEND" }, response code: 200
Deprecated usage of geo:point detected in attribute location at entity update, please use geo:json instead
Deprecated usage of legacyForwarding mode in registration creation (regId: REG_ID)
Deprecated usage of legacyForwarding mode detected in existing registration (regId: REG_ID)
Expand All @@ -337,23 +220,22 @@ Raising alarm ForwardingError localhost:9801/v2/updateContext: forwarding failur
Raising alarm BadInput 127.0.0.1: The requested entity has not been found. Check type and id


10. Get statistics and see deprecatedFeatures counters
07. Get statistics and see deprecatedFeatures counters
======================================================
HTTP/1.1 200 OK
Date: REGEX(.*)
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Content-Type: application/json
Content-Length: 468
Content-Length: 314

{
"counters": {
"deprecatedFeatures": {
"geoFormat": 2,
"ngsiv1Forwarding": 4,
"ngsiv1Requests": 3
"geoFormat": 1,
"ngsiv1Forwarding": 4
},
"jsonRequests": 5,
"noPayloadRequests": 4,
"jsonRequests": 3,
"noPayloadRequests": 3,
"requests": {
"/statistics": {
"GET": 1
Expand All @@ -369,17 +251,6 @@ Content-Length: 468
"GET": 1,
"POST": 1
}
},
"requestsLegacy": {
"/v1/contextEntities/{id}/attributes/{name}": {
"GET": 1
},
"/v1/queryContext": {
"POST": 1
},
"/v1/updateContext": {
"POST": 1
}
}
},
"measuring_interval_in_secs": REGEX(\d+),
Expand Down
Loading

0 comments on commit 769a72a

Please sign in to comment.