Skip to content

Commit

Permalink
Merge pull request #1685 from FIWARE/dds/qosFix
Browse files Browse the repository at this point in the history
Dds/qos fix
  • Loading branch information
kzangeli authored Oct 4, 2024
2 parents e6dfd9a + 2babe4a commit b88e4af
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 167 deletions.
6 changes: 6 additions & 0 deletions config/DDS_ENABLER_CONFIGURATION.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ dds:
blocklist:
- name: "add_blocked_topics_list_here"

topics:
name: "*"
qos:
durability: TRANSIENT_LOCAL
history-depth: 5

# DDS Enabler configuration
ddsenabler:

Expand Down
11 changes: 6 additions & 5 deletions src/app/orionld/orionld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ char ddsConfigFile[512];
char ddsEnablerConfigFile[512];


#define DDSE_CONF_FILE "/tmp/DDS_ENABLER_CONFIGURATION.yaml"

/* ****************************************************************************
*
Expand Down Expand Up @@ -465,11 +466,11 @@ PaArgument paArgs[] =
{ "-subordinateEndpoint", &subordinateEndpoint, "SUBORDINATE_ENDPOINT", PaStr, PaOpt, _i "", PaNL, PaNL, SUBORDINATE_ENDPOINT_DESC },
{ "-pageSize", &pageSize, "PAGE_SIZE", PaInt, PaOpt, 20, 1, 1000, PAGE_SIZE_DESC },
{ "-dds", &ddsSupport, "DDS", PaBool, PaOpt, false, false, true, USE_DDS_DESC },
{ "-ddsSubsTopics", ddsSubsTopics, "DDS_SUBS_TOPICS", PaString, PaOpt, _i "", PaNL, PaNL, DDS_SUBS_TOPICS_DESC },
{ "-ddsTopicType", ddsTopicType, "DDS_TOPIC_TYPE", PaString, PaOpt, _i "NGSI-LD", PaNL, PaNL, DDS_TOPIC_TYPE_DESC },
{ "-ddsConfigFile", ddsConfigFile, "DDS_CONFIG_FILE", PaString, PaOpt, _i "", PaNL, PaNL, DDS_CONFIG_FILE_DESC },
{ "-ddsEnablerConfigFile", ddsEnablerConfigFile, "DDS_CONFIG_FILE_PATH", PaString, PaOpt, _i "", PaNL, PaNL, DDS_ENABLER_CONFIG_FILE_DESC },
{ "-duc", defaultUserContextUrl, "DUC_URL", PaString, PaOpt, _i "", PaNL, PaNL, DUC_URL_DESC },
{ "-ddsSubsTopics", ddsSubsTopics, "DDS_SUBS_TOPICS", PaString, PaOpt, _i "", PaNL, PaNL, DDS_SUBS_TOPICS_DESC },
{ "-ddsTopicType", ddsTopicType, "DDS_TOPIC_TYPE", PaString, PaOpt, _i "NGSI-LD", PaNL, PaNL, DDS_TOPIC_TYPE_DESC },
{ "-ddsConfigFile", ddsConfigFile, "DDS_CONFIG_FILE", PaString, PaOpt, _i "", PaNL, PaNL, DDS_CONFIG_FILE_DESC },
{ "-ddsEnablerConfigFile", ddsEnablerConfigFile, "DDS_CONFIG_FILE_PATH", PaString, PaOpt, _i DDSE_CONF_FILE, PaNL, PaNL, DDS_ENABLER_CONFIG_FILE_DESC },
{ "-duc", defaultUserContextUrl, "DUC_URL", PaString, PaOpt, _i "", PaNL, PaNL, DUC_URL_DESC },

PA_END_OF_ARGS
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/orionld/dds/ddsInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int ddsInit(Kjson* kjP, DdsOperationMode _ddsOpMode)
#endif
}

KT_T(StDds, "Calling init_dds_enabler");
KT_T(StDds, "Calling init_dds_enabler('%s')", ddsEnablerConfigFile);
eprosima::ddsenabler::init_dds_enabler(ddsEnablerConfigFile, ddsNotification, ddsTypeNotification, ddsLog);

return 0;
Expand Down
175 changes: 16 additions & 159 deletions test/functionalTest/cases/0000_dds/dds_notifications.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ ftClientStart -t 0-5000
# 02. Ask FT to publish an entity urn:E2 on topic 'P2'
# 03. Ask FT to publish an entity urn:E3 on topic 'P3'
# 04. Ask FT to publish an entity urn:E4 on topic 'P4'
# 05. Query the broker for all its entities, see all three (urn:ngsi-ld:camera:cam1, urn:ngsi-ld:arm:arm1, and the default entity))
# 05. Query the broker for all its entities, see all three (urn:ngsi-ld:camera:cam1, urn:ngsi-ld:arm:arm1, and the default entity))
#
# Later:
# 06. Kill the broker and empty its databae, then restart the broker again
# 07. Query the broker for all its entities, see all three - should be present due to the DDS discovery
#
Expand Down Expand Up @@ -106,21 +108,21 @@ echo
echo


echo "06. Kill the broker and empty its database, then restart the broker again"
echo "========================================================================="
brokerStop
dbInit CB > /dev/null
orionldStart CB -mongocOnly -dds -ddsConfigFile /tmp/ddsConfig > /dev/null
echo Orion-LD is running again
echo
echo
# echo "06. Kill the broker and empty its database, then restart the broker again"
# echo "========================================================================="
# brokerStop
# dbInit CB > /dev/null
# orionldStart CB -mongocOnly -dds -ddsConfigFile /tmp/ddsConfig > /dev/null
# echo Orion-LD is running again
# echo
# echo


echo "07. Query the broker for all its entities, see all three - should be present due to the DDS discovery "
echo "======================================================================================================"
orionCurl --url /ngsi-ld/v1/entities?local=true
echo
echo
# echo "07. Query the broker for all its entities, see all three - should be present due to the DDS discovery "
# echo "======================================================================================================"
# orionCurl --url /ngsi-ld/v1/entities?local=true
# echo
# echo


--REGEXPECT--
Expand Down Expand Up @@ -292,151 +294,6 @@ Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)
]


06. Kill the broker and empty its database, then restart the broker again
=========================================================================
Orion-LD is running again


07. Query the broker for all its entities, see all three - should be present due to the DDS discovery
======================================================================================================
HTTP/1.1 200 OK
Content-Length: 1438
Content-Type: application/json
Date: REGEX(.*)
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)

[
{
"ddsType": {
"type": "Property",
"value": "fastdds"
},
"id": "urn:ngsi-ld:camera:cam1",
"shutterSpeed": {
"participantId": {
"type": "Property",
"value": "REGEX(.*)"
},
"publishedAt": {
"type": "Property",
"value": REGEX(.*)
},
"type": "Property",
"value": {
"data": {
"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0": {
"b": false,
"f": 0,
"i": 0,
"ia": [
0,
0
],
"s": "abc"
}
},
"type": "NgsildSample"
}
},
"type": "Camera"
},
{
"armReach": {
"participantId": {
"type": "Property",
"value": "REGEX(.*)"
},
"publishedAt": {
"type": "Property",
"value": REGEX(.*)
},
"type": "Property",
"value": {
"data": {
"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0": {
"b": false,
"f": 0,
"i": 2,
"ia": [
0,
0
],
"s": ""
}
},
"type": "NgsildSample"
}
},
"ddsType": {
"type": "Property",
"value": "fastdds"
},
"id": "urn:ngsi-ld:arm:arm1",
"type": "Arm"
},
{
"P3": {
"participantId": {
"type": "Property",
"value": "REGEX(.*)"
},
"publishedAt": {
"type": "Property",
"value": REGEX(.*)
},
"type": "Property",
"value": {
"data": {
"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0": {
"b": false,
"f": 3.14,
"i": 0,
"ia": [
0,
0
],
"s": ""
}
},
"type": "NgsildSample"
}
},
"P4": {
"participantId": {
"type": "Property",
"value": "REGEX(.*)"
},
"publishedAt": {
"type": "Property",
"value": REGEX(.*)
},
"type": "Property",
"value": {
"data": {
"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0": {
"b": false,
"f": 4.14,
"i": 4,
"ia": [
0,
0
],
"s": "p4"
}
},
"type": "NgsildSample"
}
},
"ddsType": {
"type": "Property",
"value": "fastdds"
},
"id": "urn:ngsi-ld:dds:default",
"type": "DDS"
}
]


--TEARDOWN--
ftClientStop
brokerStop
Expand Down
4 changes: 2 additions & 2 deletions test/functionalTest/ftClient/NgsildPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ bool NgsildPublisher::init(const char* topicName)

wqos.reliability().kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS;
wqos.durability().kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS;
// wqos.history().kind = eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS;
// wqos.history().depth = 5;
wqos.history().kind = eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS;
wqos.history().depth = 5;
writer_ = publisher_->create_datawriter(topic_, wqos, &listener_);

if (writer_ == nullptr)
Expand Down

0 comments on commit b88e4af

Please sign in to comment.