Skip to content

Commit 15d9af5

Browse files
authored
Use Eclipse uProtocol for sending vehicle status updates
The FMS Forwarder has been changed to use uProtocol Publish messages for sending vehicle status updates to the back end (FMS Consumer). The direct connection to the InfluxDB has been removed in favor of the Zenoh based uProtocol transport. As an alternative, custom uProtocol transports for Hono's MQTT adapter and the Kafka messaging infrastructure have been added.
1 parent 59b4b4a commit 15d9af5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3429
-2142
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
deps_file=${DEPS_FILE:-"DEPS.txt"}
3+
dash_jar=${DASH_JAR:-"/tmp/dash.jar"}
4+
dash_summary=${DASH_SUMMARY:-"DASH_SUMMARY.txt"}
5+
project=${PROJECT:-"automotive.uprotocol"}
6+
token=$1
7+
8+
echo "creating 3rd party dependency list..."
9+
cargo tree --manifest-path components/Cargo.toml -e no-build,no-dev --prefix none --no-dedupe --locked \
10+
| sed -n '2~1p' \
11+
| sort -u \
12+
| grep -v '^[[:space:]]*$' \
13+
| grep -v fms- \
14+
| grep -v influx-client \
15+
| grep -v up-transport-hono \
16+
| sed -E 's|([^ ]+) v([^ ]+).*|crate/cratesio/-/\1/\2|' \
17+
> "$deps_file"
18+
19+
if [[ ! -r "$dash_jar" ]]; then
20+
echo "Eclipse Dash JAR file [${dash_jar}] not found, downloading latest version from GitHub..."
21+
wget_bin=$(which wget)
22+
if [[ -z "$wget_bin" ]]; then
23+
echo "wget command not available on path"
24+
exit 127
25+
else
26+
wget --quiet -O "$dash_jar" "https://repo.eclipse.org/service/local/artifact/maven/redirect?r=dash-licenses&g=org.eclipse.dash&a=org.eclipse.dash.licenses&v=LATEST"
27+
echo "successfully downloaded Eclipse Dash JAR to ${dash_jar}"
28+
fi
29+
fi
30+
31+
args=(-jar "$dash_jar" -timeout 60 -batch 90 -summary "$dash_summary")
32+
if [[ -n "$token" ]]; then
33+
args=("${args[@]}" -review -token "$token" -project "$project")
34+
fi
35+
args=("${args[@]}" "$deps_file")
36+
37+
echo "checking 3rd party licenses..."
38+
java "${args[@]}"

.github/workflows/check-dependencies.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,14 @@ jobs:
3030
deps:
3131
name: "Check 3rd party Rust dependencies' licenses"
3232
runs-on: ubuntu-latest
33+
env:
34+
DASH_SUMMARY: "DEPENDENCIES.txt"
3335
steps:
3436
- uses: actions/checkout@v4
35-
- name: Determine list of 3rd party Rust dependencies
36-
working-directory: ${{github.workspace}}
37-
run: |
38-
cargo tree --manifest-path components/Cargo.toml -e no-build,no-dev --prefix none --no-dedupe --locked \
39-
| sort -u \
40-
| grep -v '^[[:space:]]*$' \
41-
| grep -v fms- \
42-
| grep -v influx-client \
43-
| grep -v zenoh \
44-
| sed -E 's|([^ ]+) v([^ ]+).*|crate/cratesio/-/\1/\2|' \
45-
> DEPS.txt
46-
- name: Set up JDK
47-
uses: actions/setup-java@v4
48-
with:
49-
distribution: "temurin"
50-
java-version: "17"
51-
- name: "Run latest Eclipse Dash jar file"
37+
- name: "Check 3rd party license compatibility"
5238
id: "run-checks"
53-
working-directory: ${{github.workspace}}
5439
run: |
55-
wget --quiet -O dash.jar "https://repo.eclipse.org/service/local/artifact/maven/redirect?r=dash-licenses&g=org.eclipse.dash&a=org.eclipse.dash.licenses&v=LATEST"
56-
if java -Dorg.eclipse.dash.timeout=60 -jar dash.jar -batch 90 -summary DEPENDENCIES.txt DEPS.txt
40+
if .github/scripts/check-3rd-party-licenses.sh
5741
then
5842
echo "checks-failed=0" >> $GITHUB_OUTPUT
5943
echo "License information of 3rd party dependencies has been vetted successfully." >> $GITHUB_STEP_SUMMARY
@@ -67,7 +51,7 @@ jobs:
6751
uses: actions/upload-artifact@v4
6852
with:
6953
name: 3rd-party-dependencies
70-
path: DEPENDENCIES.txt
54+
path: ${{ env.DASH_SUMMARY }}
7155
- name: "Determine exit code"
7256
env:
7357
EXIT_CODE: ${{ steps.run-checks.outputs.checks-failed }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
*.drawio.bkp
2222
**/target
2323

24-
config/
24+
config/hono/
2525
*.env

.sdv-blueprint.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,23 @@
33
"version": "0.1.0",
44
"description": "A close to real-life showcase for truck fleet management where trucks run an SDV software stack so that logistics fleet operators can manage apps, data and services for a diverse set of vehicles.",
55
"participatingProjects": [
6-
{ "id": "automotive.kuksa" },
7-
{ "id": "automotive.leda" },
8-
{ "id": "iot.hono" },
9-
{ "id": "iot.paho" }
6+
{
7+
"id": "automotive.kuksa"
8+
},
9+
{
10+
"id": "automotive.leda"
11+
},
12+
{
13+
"id": "automotive.uprotocol"
14+
},
15+
{
16+
"id": "iot.hono"
17+
},
18+
{
19+
"id": "iot.paho"
20+
},
21+
{
22+
"id": "iot.zenoh"
23+
}
1024
]
11-
}
25+
}

DEPENDENCIES

Lines changed: 0 additions & 308 deletions
This file was deleted.

README.md

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,32 @@ for truck fleet management where trucks run an SDV software stack so that logist
2929
manage apps, data and services for a diverse set of vehicles.
3030

3131
The use case illustrates how the standard VSS model can be customized and used to report data from a vehicle
32-
to a back end. The following diagram provides an overview of the current architecture:
32+
to a back end. It also shows how [Eclipse uProtocol™](https://eclipse-uprotocol.github.io) can be used to connect in-vehicle components to an off-vehicle service in the back end. uProtocol provides a generic API for using the well known pub/sub and RPC message exchange patterns over arbitrary transport protocols like MQTT, Eclipse Zenoh etc.
3333

34-
<img src="img/architecture.drawio.svg">
34+
The following component diagram provides a high level overview of the building blocks and how they are related to each other.
35+
36+
<img src="img/architecture-uprotocol.drawio.svg">
3537

3638
The overall idea is to enable back end applications to consume data coming from a vehicle using the rFMS API.
3739

3840
Data originates from the vehicle's sensors which are represented by a CSV file that is being played back by the
39-
kuksa.val CSV feeder. The CSV feeder publishes the data to the kuksa.val Databroker. From there, the FMS Forwarder
40-
consumes the data and writes it to an InfluxDB in the back end. The measurements in the InfluxDB can then be
41-
visualized in a web browser by means of a Grafana dashboard. Alternatively, the measurements can be retrieved by
42-
a Fleet Management application via the FMS Server's (HTTP based) rFMS API.
41+
[Eclipse Kuksa&trade; CSV Provider](https://github.com/eclipse-kuksa/kuksa-csv-provider). The *CSV Provider* publishes
42+
the data to the [Kuksa Databroker](https://github.com/eclipse-kuksa/kuksa-databroker).
43+
The *FMS Forwarder* reads the signal values from the Databroker and sends them to the *FMS Consumer* in the back end. The FMS Consumer then writes the measurements to an *InfluxDB* from where it
44+
can be visualized in a web browser by means of a *Grafana* dashboard. Alternatively, the measurements can be
45+
retrieved by a Fleet Management application via the *FMS Server's* (HTTP based) rFMS API.
46+
47+
Both the FMS Forwarder and Consumer are implemened as uProtocol entities (_uEntity_). This allows the FMS Forwarder to send its data to the Consumer by means of a uProtocol _Notification_. The concrete transport protocol being used to transmit the message on the wire is a matter of configuration and has no impact on the implementation of the business logic itself.
4348

4449
# Quick Start
4550

4651
The easiest way to set up and start the services is by means of using the Docker Compose file in the top level folder:
4752

4853
```sh
49-
docker compose -f ./fms-blueprint-compose.yaml up --detach
54+
docker compose -f ./fms-blueprint-compose.yaml -f ./fms-blueprint-compose-zenoh.yaml up --detach
5055
```
5156

52-
This will pull or build (if necessary) the container images and create and start all components.
57+
This will pull (or build if necessary) the container images and create and start all components.
5358

5459
Once all services have been started, the current vehicle status can be viewed on a [Grafana dashboard](http://127.0.0.1:3000),
5560
using *admin*/*admin* as username and password for logging in.
@@ -61,16 +66,18 @@ The rFMS API can be used to retrieve the data, e.g.
6166
curl -v -s http://127.0.0.1:8081/rfms/vehicleposition?latestOnly=true | jq
6267
```
6368

64-
# Using Eclipse Hono to send Vehicle Data to Back End
69+
# Eclipse Zenoh&trade; Transport
6570

66-
By default, the Docker Compose file starts the FMS Forwarder configured to write vehicle data directly to the
67-
Influx DB running in the back end.
71+
The command line from the quick start section will start up containers for the _FMS Forwarder_ and _FMS Consumer_ that are configured to use a [Zenoh](https://zenoh.io) based uProtocol transport as shown in the deployment diagram below:
6872

69-
However, in a real world scenario, this tight coupling between the vehicle and the Influx DB is not desirable.
70-
As an alternative, the blueprint supports configuring the FMS Forwarder to send vehicle data to the MQTT adapter
71-
of an Eclipse Hono instance as shown in the diagram below.
73+
<img src="img/architecture-zenoh.drawio.svg">
7274

73-
<img src="img/architecture-hono.drawio.svg">
75+
# Eclipse Hono&trade; based Transport
76+
77+
The blueprint can also be configured to use a Hono based uProtocol transport that employs Hono's MQTT adapter
78+
and Apache Kafka&trade; based messaging infrastructure for sending vehicle data to the Consumer.
79+
80+
In order to run the blueprint with the Hono transport, perform the following steps:
7481

7582
1. Register the vehicle as a device in Hono using the [create-config-hono.sh shell script](./create-config-hono.sh):
7683

@@ -80,7 +87,7 @@ of an Eclipse Hono instance as shown in the diagram below.
8087

8188
Make sure to replace `MY_TENANT_ID`, `MY_DEVICE_ID` and `MY_PWD` with your own values.
8289

83-
The script registers the tenant and device in Hono's Sandbox installation at `hono.eclipseprojects.io` unless the
90+
The script registers the tenant and device in [Hono's Sandbox installation](https://eclipse.dev/hono/sandbox/) at `hono.eclipseprojects.io` unless the
8491
`--host` and/or `--kafka-brokers` command line arguments are used. Use the `--help` switch to print usage information.
8592

8693
The script also creates configuration files in the `OUT_DIR/config/hono` folder. The OUT_DIR can be specified using
@@ -95,25 +102,9 @@ of an Eclipse Hono instance as shown in the diagram below.
95102

96103
The path set via the `--env-file` option needs to be adapted to the output folder specified in the previous step.
97104

98-
The second compose file specified on the command line will also start the [FMS Consumer](./components/fms-consumer)
99-
back end component which receives vehicle data via Hono's north bound Kafka based Telemetry API and writes it to the
100-
Influx DB.
101-
102-
# Using Eclipse Zenoh to geographically distribute the vehicle data
103-
104-
The blueprint supports configuring the FMS Forwarder to send vehicle data to the Eclipse Zenoh router of an [Eclipse Zenoh](https://zenoh.io/) instance as shown in the diagram below.
105-
Zenoh router provides a plugin mechanism to other protocols to enable the Vehicle to anything communication.
106-
107-
<img src="img/architecture-zenoh.drawio.svg">
105+
This will result in a deployment as shown below:
108106

109-
Start up the vehicle and back end services using Docker Compose:
110-
111-
```sh
112-
docker compose -f ./fms-blueprint-compose.yaml -f ./fms-blueprint-compose-zenoh.yaml up --detach
113-
```
114-
115-
Once all services have been started, the current vehicle status can be viewed on a [Grafana dashboard](http://127.0.0.1:3000),
116-
using *admin*/*admin* as username and password for logging in.
107+
<img src="img/architecture-hono.drawio.svg">
117108

118109
# Manual configuration
119110

@@ -125,5 +116,6 @@ Additional information can be found in the components' corresponding subfolders.
125116

126117
# Contributing
127118

128-
We are looking forward to your ideas and PRs. Each PRs triggers a GitHub action which checks the formating, performs linting and runs the test. You can performe similar check in your development environment. For more details check the respective [action](.github/workflows/lint_source_code.yaml) where the checks are listed in the bottom of the file.
129-
119+
We are looking forward to your ideas and PRs. Each PRs triggers a GitHub action which checks the formating, performs
120+
linting and runs the test. You can performe similar check in your development environment. For more details check the
121+
respective [action](.github/workflows/lint_source_code.yaml) where the checks are listed in the bottom of the file.

0 commit comments

Comments
 (0)