Skip to content

Commit

Permalink
Merge branch 'master' into remove/ngsiv1-deadcode
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Feb 27, 2025
2 parents 723b385 + 174ac1d commit 3f24ae1
Show file tree
Hide file tree
Showing 47 changed files with 2,340 additions and 173 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ jobs:
ports:
- 27017:27017

mosquitto:
# Needed by MQTT notification tests
image: eclipse-mosquitto:1.6.15
ports:
- 1883:1883

mosquitto-extra:
# Needed by MQTT notification tests (multi broker)
image: eclipse-mosquitto:1.6.15
ports:
- 1884:1883

name: functional - ${{ matrix.payload.name }}

strategy:
Expand All @@ -58,6 +46,17 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Run Mosquitto container with authenticated user
# Why don't to use a service for this (as moquitto-extra above)? It would be the desirable solution, but I haven't able to
# configure volumes properly for it (the mosquitto container as service has problems to get the configuration files). Feedback welcome! :)
run: docker run -d --name mosquitto -p 1883:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run Extra Mosquitto container used in multibroker tests
# Note we are reusing the same volume (although the extra broker does not require authenticated user). We use a service in the past
# to implement this (using eclipse-mosquitto:1.6.15) but in eclipse-mosquitto:2.0.11 it seems something in the internal configuration
# has changed and it doesn't work if we don't provide the configuration files in the volume. Again, feedback is welcome! :)
run: docker run -d --name mosquitto-extra -p 1884:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run functional test
run: |
docker run --network host -t --rm -e REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} ${{ matrix.payload.range }} -v $(pwd):/opt/fiware-orion ${{ env.TEST_IMAGE_NAME }} build -miqts functional
23 changes: 11 additions & 12 deletions .github/workflows/valgrind-nocache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ jobs:
image: mongo:6.0
ports:
- 27017:27017

mosquitto:
# Needed by MQTT notification tests
image: eclipse-mosquitto:1.6.15
ports:
- 1883:1883

mosquitto-extra:
# Needed by MQTT notification tests (multi broker)
image: eclipse-mosquitto:1.6.15
ports:
- 1884:1883

name: valgrind - ${{ matrix.payload.name }}

Expand All @@ -56,6 +44,17 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Run Mosquitto container with authenticated user
# Why don't to use a service for this (as moquitto-extra above)? It would be the desirable solution, but I haven't able to
# configure volumes properly for it (the mosquitto container as service has problems to get the configuration files). Feedback welcome! :)
run: docker run -d --name mosquitto -p 1883:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run Extra Mosquitto container used in multibroker tests
# Note we are reusing the same volume (although the extra broker does not require authenticated user). We use a service in the past
# to implement this (using eclipse-mosquitto:1.6.15) but in eclipse-mosquitto:2.0.11 it seems something in the internal configuration
# has changed and it doesn't work if we don't provide the configuration files in the volume. Again, feedback is welcome! :)
run: docker run -d --name mosquitto-extra -p 1884:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run valgrind test
run: |
docker run --privileged --network host -t --rm -e REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} ${{ matrix.payload.range }} -v $(pwd):/opt/fiware-orion ${{ env.TEST_IMAGE_NAME }} build -miqts valgrind
23 changes: 11 additions & 12 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ jobs:
image: mongo:6.0
ports:
- 27017:27017

mosquitto:
# Needed by MQTT notification tests
image: eclipse-mosquitto:1.6.15
ports:
- 1883:1883

mosquitto-extra:
# Needed by MQTT notification tests (multi broker)
image: eclipse-mosquitto:1.6.15
ports:
- 1884:1883

name: valgrind - ${{ matrix.payload.name }}

Expand All @@ -53,6 +41,17 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Run Mosquitto container with authenticated user
# Why don't to use a service for this (as moquitto-extra above)? It would be the desirable solution, but I haven't able to
# configure volumes properly for it (the mosquitto container as service has problems to get the configuration files). Feedback welcome! :)
run: docker run -d --name mosquitto -p 1883:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run Extra Mosquitto container used in multibroker tests
# Note we are reusing the same volume (although the extra broker does not require authenticated user). We use a service in the past
# to implement this (using eclipse-mosquitto:1.6.15) but in eclipse-mosquitto:2.0.11 it seems something in the internal configuration
# has changed and it doesn't work if we don't provide the configuration files in the volume. Again, feedback is welcome! :)
run: docker run -d --name mosquitto-extra -p 1884:1883 -v $(pwd)/test/functionalTest/mosquittoConf:/mosquitto/config:ro eclipse-mosquitto:2.0.11

- name: Run valgrind test
run: |
docker run --privileged --network host -t --rm -e REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} ${{ matrix.payload.range }} -v $(pwd):/opt/fiware-orion ${{ env.TEST_IMAGE_NAME }} build -miqts valgrind
7 changes: 6 additions & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
- Fix: registrations with more than one contextRegistration element (not possible in NGSIv2) are logged as Runtime Errors
- Fix: rendering of large float numbers (according IEEE754 standard) (#4642)
- Fix: notification was not triggered in subs using entityUpdate alterationType when some attribute not included in condition.attrs has an actual value change (#4647)
- Fix: previousValue metadata was not taken into account in attributes not in the update that triggers the notification (#4643)
- Fix: improve attribute and metadata invalid format dates for DateTime types in logs (#4616)
- Fix: attrsFormat keyValues and values were not working in custom notifications using ngsi payloads (#4644)
- Fix: JEXL expressions were not working in attrsFormat simplifiedKeyValues, keyValues or values (#4645)
- Hardening: upgrade microhttpd dependency from 0.9.76 to 1.0.1
- Hardening: upgrade libmosquitto dependency from 2.0.15 to 2.0.20
- Hardening: upgrade libmongoc dependency from 1.24.3 to 1.29.0
- Upgrade Debian version from 12.6 to 12.7 in Dockerfile
- Upgrade Debian version from 12.6 to 12.9 in Dockerfile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ tag `fiware-orion`
Orion Context Broker is licensed under [Affero General Public License (GPL)
version 3](./LICENSE).

© 2024 Telefonica Investigación y Desarrollo, S.A.U
© 2025 Telefonica Investigación y Desarrollo, S.A.U

<details>
<summary><strong>Further information on the use of the AGPL open source license</strong></summary>
Expand Down
2 changes: 1 addition & 1 deletion ci/deb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:12.7-slim
FROM debian:12.9-slim

ADD build.sh /opt/bin/
ADD build-dep.sh /opt/bin/
Expand Down
2 changes: 1 addition & 1 deletion doc/manuals.jp/admin/build_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Orion Context Broker は、以下のライブラリをビルドの依存関係
* boost: 1.74
* libmicrohttpd: 1.0.1 (ソースから)
* libcurl: 7.88.1
* openssl: 3.0.14
* openssl: 3.0.15
* libuuid: 2.38.1
* libmosquitto: 2.0.20 (ソースから)
* Mongo C driver: 1.29.0 (ソースから)
Expand Down
2 changes: 1 addition & 1 deletion doc/manuals.jp/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Docker hub で公式の Orion docker コンテナを使用してインストー

必要なソースから ビルドした Orion をインストールする場合:

* オペレーティングシステム: Debian。リファレンス・オペレーティングシステムは Debian 12.7 ですが、それ以降の
* オペレーティングシステム: Debian。リファレンス・オペレーティングシステムは Debian 12.9 ですが、それ以降の
Debian 12 バージョンでも動作するはずです
* データベース: MongoDB は、Orion Context Broker がインストールされるのと同じホストで実行するか、ネットワーク経由で
アクセスできる別のホストで実行する必要があります。推奨される MongoDB バージョンは 6.0 です (Orion は古いバージョンで
Expand Down
6 changes: 4 additions & 2 deletions doc/manuals.jp/orion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ NGSI では、メタデータにネストされたメタデータが含まれる
[ 'Ford', 'black', 78.3 ]
```

- *unique* モード。このモードは、値が繰り返されない点を除いて、*values* モードと同じです
- *unique* モード。このモードは、値が繰り返されない点を除いて、*values* モードと同じです。このモードはサブスクリプションの `attrsFormat` ではサポートされていないことに注意してください ([通知メッセージのセクション](#notification-messages)を参照)

<a name="partial-representations"></a>

Expand Down Expand Up @@ -683,7 +683,7 @@ Orion は階層スコープをサポートしているため、エンティテ
- `dateExpires` (型: `DateTime`): エンティティの有効期限。ISO 8601 文字列です。Orion がエンティティの有効期限を制御
する方法については、[一時エンティティのセクション](#transient-entities) で説明されています
- `alterationType` (タイプ: `Text`): 通知をトリガーする変更を指定します。これは、変更タイプの機能に基づく
サブスクリプションに関連しています ([変更タイプに基づくサブスクリプション](#subscriptions_alttype)のセクションを
サブスクリプションに関連しています ([変更タイプに基づくサブスクリプション](#subscriptions-based-in-alteration-type)のセクションを
参照)
この属性は通知でのみ使用できます。クエリ (`GET /v2/entities?attrs=alterationType`) を実行しても表示されず、次の値を
取ることができます:
Expand Down Expand Up @@ -3509,6 +3509,8 @@ EOF
デフォルトの `alterationTypes` (つまり、明示的に指定されていないサブスクリプション用のもの) は
`["entityCreate", "entityChange"]` です。

`entityChange``entityUpdate` を同時に使用する場合、`entityUpdate` が優先されます (つまり、`"alterationTypes": [ "entityUpdate", "entityChange" ]` を使用することは、`"alterationTypes": [ "entityUpdate" ]` を使用することと同等です)。

特定の変更タイプは、[`alterationType` 組み込み属性](#builtin-attributes)を使用して通知で取得できます。

<a name="pagination"></a>
Expand Down
2 changes: 1 addition & 1 deletion doc/manuals/admin/build_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Orion Context Broker uses the following libraries as build dependencies:
* boost: 1.74
* libmicrohttpd: 1.0.1 (from source)
* libcurl: 7.88.1
* openssl: 3.0.14
* openssl: 3.0.15
* libuuid: 2.38.1
* libmosquitto: 2.0.20 (from source)
* Mongo C driver: 1.29.0 (from source)
Expand Down
2 changes: 1 addition & 1 deletion doc/manuals/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ In the case you install using the official Orion docker container at Dockerhub,

In the case you are installing Orion building from sources you need:

* Operating system: Debian. The reference operating system is Debian 12.7
* Operating system: Debian. The reference operating system is Debian 12.9
but it should work also in any later Debian 12 version.
* Database: MongoDB is required to run either in the same host where Orion Context Broker is to be installed or in a different host accessible through the network. The recommended MongoDB version
is 6.0 (Orion may work with older versions but we don't recommend it at all!).
Expand Down
8 changes: 6 additions & 2 deletions doc/manuals/orion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ representations of entities.
[ 'Ford', 'black', 78.3 ]
```

* *unique mode*. This mode is just like *values mode*, except that values are not repeated.
* *unique mode*. This mode is just like *values mode*, except that values are not repeated. Note this mode is not supported in `attrsFormat` in subscriptions (see [Notification Messages section](#notification-messages)).

## Partial Representations

Expand Down Expand Up @@ -714,7 +714,7 @@ The list of builtin attributes is as follows:
controls entity expiration is described in [Transient entities section](#transient-entities).

* `alterationType` (type: `Text`): specifies the change that triggers the notification. It is related with
the subscriptions based in alteration type features (see [Subscription based in alteration type](#subscriptions_alttype) section). This attribute
the subscriptions based in alteration type features (see [Subscription based in alteration type](#subscriptions-based-in-alteration-type) section). This attribute

can be used only in notifications, it does not appear when querying it (`GET /v2/entities?attrs=alterationType`) and can take the following values:
* `entityCreate` if the update that triggers the notification is a entity creation operation
Expand Down Expand Up @@ -3429,6 +3429,10 @@ update takes place. The elements in the `alterationTypes` array are interpreted
Default `alterationTypes` (i.e. the one for subscription not explicitly specifying it)
is `["entityCreate", "entityChange"]`.

In the case of using `entityChange` and `entityUpdate` at the same time, `entityUpdate` takes precedence
(in other words, using `"alterationTypes": [ "entityUpdate", "entityChange" ]` is equivalente to
use `"alterationTypes": [ "entityUpdate" ]`).

The particular alteration type can be got in notifications using the
[`alterationType` builtin attribute](#builtin-attributes).

Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mkdocs==1.2.4
Pygments==2.15.0
Markdown==3.3.4
jinja2==3.1.4
jinja2==3.1.5
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#

ARG IMAGE_NAME=debian
ARG IMAGE_TAG=12.7-slim
ARG IMAGE_TAG=12.9-slim
FROM ${IMAGE_NAME}:${IMAGE_TAG}

ARG GITHUB_ACCOUNT=telefonicaid
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_files_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def ignore(root, file):
'ContributionPolicy.txt', 'CHANGES_NEXT_RELEASE', 'Changelog', 'compileInfo.h',
'unittests_that_fail_sporadically.txt', 'Vagrantfile', 'contextBroker.ubuntu',
'mkdocs.yml', 'fiware-ngsiv2-reference.errata', 'ServiceRoutines.txt', '.readthedocs.yml', 'uncrustify.cfg',
'requirements.txt']
'requirements.txt', 'mosquitto_passwd' ]
if file in files_names:
return True
if 'scripts' in root and (file == 'cpplint.py' or file == 'pdi-pep8.py' or file == 'uncrustify.cfg' \
Expand Down
13 changes: 7 additions & 6 deletions src/lib/apiTypesV2/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,14 @@ std::string Entity::toJson
switch (renderFormat)
{
case NGSI_V2_VALUES:
out = toJsonValues(orderedAttrs);
out = toJsonValues(orderedAttrs, exprContextObjectP);
break;
case NGSI_V2_UNIQUE_VALUES:
// unique is not allowed in attrsFormat, so no need of passing exprContextObjectP here
out = toJsonUniqueValues(orderedAttrs);
break;
case NGSI_V2_KEYVALUES:
out = toJsonKeyvalues(orderedAttrs);
out = toJsonKeyvalues(orderedAttrs, exprContextObjectP);
break;
default: // NGSI_V2_NORMALIZED
out = toJsonNormalized(orderedAttrs, metadataFilter, renderNgsiField, exprContextObjectP);
Expand Down Expand Up @@ -263,14 +264,14 @@ std::string Entity::toJson(RenderFormat renderFormat, bool renderNgsiField)
*
* Entity::toJsonValues -
*/
std::string Entity::toJsonValues(const std::vector<ContextAttribute*>& orderedAttrs)
std::string Entity::toJsonValues(const std::vector<ContextAttribute*>& orderedAttrs, ExprContextObject* exprContextObjectP)
{
JsonVectorHelper jh;

for (unsigned int ix = 0; ix < orderedAttrs.size(); ix++)
{
ContextAttribute* caP = orderedAttrs[ix];
jh.addRaw(caP->toJsonValue());
jh.addRaw(caP->toJsonValue(exprContextObjectP));
}

return jh.str();
Expand Down Expand Up @@ -315,7 +316,7 @@ std::string Entity::toJsonUniqueValues(const std::vector<ContextAttribute*>& ord
*
* Entity::toJsonKeyvalues -
*/
std::string Entity::toJsonKeyvalues(const std::vector<ContextAttribute*>& orderedAttrs)
std::string Entity::toJsonKeyvalues(const std::vector<ContextAttribute*>& orderedAttrs, ExprContextObject* exprContextObjectP)
{
JsonObjectHelper jh;

Expand All @@ -330,7 +331,7 @@ std::string Entity::toJsonKeyvalues(const std::vector<ContextAttribute*>& ordere
for (unsigned int ix = 0; ix < orderedAttrs.size(); ix++)
{
ContextAttribute* caP = orderedAttrs[ix];
jh.addRaw(caP->name, caP->toJsonValue());
jh.addRaw(caP->name, caP->toJsonValue(exprContextObjectP));
}

return jh.str();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/apiTypesV2/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class Entity

void addAllAttrsExceptFiltered(std::vector<ContextAttribute*>* orderedAttrs);

std::string toJsonValues(const std::vector<ContextAttribute*>& orderedAttrs);
std::string toJsonValues(const std::vector<ContextAttribute*>& orderedAttrs, ExprContextObject* exprContextObjectP = NULL);
std::string toJsonUniqueValues(const std::vector<ContextAttribute*>& orderedAttrs);
std::string toJsonKeyvalues(const std::vector<ContextAttribute*>& orderedAttrs);
std::string toJsonKeyvalues(const std::vector<ContextAttribute*>& orderedAttrs, ExprContextObject* exprContextObjectP = NULL);
std::string toJsonNormalized(const std::vector<ContextAttribute*>& orderedAttrs,
const std::vector<std::string>& metadataFilter,
bool renderNgsiField = false,
Expand Down
26 changes: 25 additions & 1 deletion src/lib/cache/subCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,28 @@ static bool servicePathMatch(CachedSubscription* cSubP, char* servicePath)



/* ****************************************************************************
*
* subHasAltType
*
*/
static bool subHasAltType(CachedSubscription* cSubP, ngsiv2::SubAltType targetAltType)
{
if (cSubP->subAltTypeV.size() != 0)
{
for (unsigned int ix = 0; ix < cSubP->subAltTypeV.size(); ix++)
{
if (cSubP->subAltTypeV[ix] == targetAltType)
{
return true;
}
}
}
return false;
}



/* ****************************************************************************
*
* matchAltType -
Expand Down Expand Up @@ -501,7 +523,9 @@ static bool subMatch
//
// Depending of the alteration type, we use the list of attributes in the request or the list
// with effective modifications. Note that EntityDelete doesn't check the list
if (targetAltType == ngsiv2::EntityUpdate)
// The second part of the || (i.e. isChangeAltType and sub alt types include entityUpdate) is due to issue #4647
// (not sure if a smarter and cleaner solution is possible...)
if ((targetAltType == ngsiv2::EntityUpdate) || ((isChangeAltType(targetAltType)) && (subHasAltType(cSubP, ngsiv2::EntityUpdate))))
{
if (!attributeMatch(cSubP, attributes))
{
Expand Down
Loading

0 comments on commit 3f24ae1

Please sign in to comment.