diff --git a/someip2val/.dockerignore b/.dockerignore similarity index 100% rename from someip2val/.dockerignore rename to .dockerignore diff --git a/.github/workflows/check_license.yml b/.github/workflows/check_license.yml index 831dc45..df728a0 100755 --- a/.github/workflows/check_license.yml +++ b/.github/workflows/check_license.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # required to grab the history of the PR fetch-depth: 0 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index c94edd7..f3c8bf1 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,11 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # required to grab the history of the PR fetch-depth: 0 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.0 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - uses: pre-commit/action@v3.0.1 with: extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/someip2val_build.yml b/.github/workflows/someip_provider.yml similarity index 84% rename from .github/workflows/someip2val_build.yml rename to .github/workflows/someip_provider.yml index c701395..d6af55b 100644 --- a/.github/workflows/someip2val_build.yml +++ b/.github/workflows/someip_provider.yml @@ -31,6 +31,10 @@ concurrency: group: ${{ github.ref }}-${{ github.workflow }} cancel-in-progress: true +# Needed as default_workflow_permissions is "read" +permissions: + packages: write + jobs: check_ghcr_push: @@ -60,16 +64,16 @@ jobs: pip3 install conan==1.55.0 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run build - working-directory: ${{github.workspace}}/someip2val + working-directory: ${{github.workspace}} run: ./build-release.sh ${{ matrix.target-arch }} - name: Upload Binaries uses: actions/upload-artifact@v3 with: - name: someip2val_${{ matrix.target-arch }}_release + name: someip-provider_${{ matrix.target-arch }}_release path: | ${{github.workspace}}/someip2val/target/${{ matrix.target-arch }}/release/install/bin ${{github.workspace}}/someip2val/target/${{ matrix.target-arch }}/release/install/lib/libvsomeip*.so.3 @@ -96,16 +100,16 @@ jobs: echo - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 if: needs.check_ghcr_push.outputs.push == 'true' with: registry: ghcr.io @@ -114,10 +118,10 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | - ghcr.io/${{ github.repository }}/someip-feeder + ghcr.io/${{ github.repository }}/someip-provider tags: | type=ref,event=branch type=ref,event=pr @@ -128,15 +132,16 @@ jobs: - name: "Build someip2val container and push to ghcr.io" if: needs.check_ghcr_push.outputs.push == 'true' id: image_build_ghcr - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: pull: false push: true - file: ./someip2val/Dockerfile - context: "./someip2val" + file: ./Dockerfile + context: . platforms: linux/amd64, linux/arm64 tags: | ${{ steps.meta.outputs.tags }} + ttl.sh/eclipse-kuksa/kuksa-someip-provider/someip-provider-${{github.sha}} ttl.sh/kuksa.val.feeders/someip-feeder-${{github.sha}} labels: ${{ steps.meta.outputs.labels }} # Provenance to solve that an unknown/unkown image is shown on ghcr.io @@ -146,15 +151,15 @@ jobs: - name: "Build someip2val container and push to ttl.sh" if: needs.check_ghcr_push.outputs.push == 'false' id: image_build_ttl - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: pull: false push: true - file: ./someip2val/Dockerfile - context: "./someip2val" + file: ./Dockerfile + context: . platforms: linux/amd64, linux/arm64 tags: | - ttl.sh/kuksa.val.feeders/someip-feeder-${{github.sha}} + ttl.sh/eclipse-kuksa/kuksa-someip-provider/someip-provider-${{github.sha}} labels: ${{ steps.meta.outputs.labels }} # Provenance to solve that an unknown/unkown image is shown on ghcr.io # Same problem as described in https://github.com/orgs/community/discussions/45969 diff --git a/someip2val/.gitignore b/.gitignore similarity index 100% rename from someip2val/.gitignore rename to .gitignore diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e4edcc..1765e8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,3 @@ repos: - id: check-yaml - id: check-added-large-files -- repo: https://github.com/pycqa/flake8 - rev: '7.0.0' - hooks: - - id: flake8 diff --git a/someip2val/CMakeLists.txt b/CMakeLists.txt similarity index 100% rename from someip2val/CMakeLists.txt rename to CMakeLists.txt diff --git a/someip2val/Dockerfile b/Dockerfile similarity index 100% rename from someip2val/Dockerfile rename to Dockerfile diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/README.md b/README.md index 32dc1d9..564f7f4 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,192 @@ -# Kuksa Feeders -![kuksa.val Logo](./doc/img/logo.png) +# KUKSA SOME/IP Provider -This are data feeders for VSS based systems. The feeders here work with [KUKSA.val](https://github.com/eclipse/kuksa.val) +![KUKSA Logo](./doc/img/logo.png) + +- [SOME/IP integration in Docker containers](#someip-integration-in-docker-containers) +- [SOME/IP to KUKSA Provider](#someip-to-kuksa-provider) + - [Overview](#overview) + - [Module summary](#module-summary) + - [Setup Development environment](#setup-development-environment) + - [Prerequisites](#prerequisites) + - [Building someip-provider](#building-someip-provider) + - [Configuration](#configuration) + - [vsomeip specific Configuration](#vsomeip-specific-configuration) + - [Environment variables for vsomeip](#environment-variables-for-vsomeip) + - [Wiper configuration files](#wiper-configuration-files) + - [Config file modifications](#config-file-modifications) + - [Runing someip example and someip provider](#runing-someip-example-and-someip-provider) + - [Local mode (single host)](#local-mode-single-host) + - [UDP mode (2 hosts)](#udp-mode-2-hosts) + - [Extending someip provider](#extending-someip-provider) + - [Running someip provider with Authorization](#running-someip-provider-with-authorization) + +## SOME/IP integration in Docker containers + +Running default vsomeip examples in containers is described in details [here](docker/README.md) + +## SOME/IP to KUKSA Provider + +### Overview + +[SOME/IP](https://www.autosar.org/fileadmin/standards/R22-11/FO/AUTOSAR_PRS_SOMEIPProtocol.pdf) is an automotive communication protocol which supports remote procedure calls, event notifications, service discovery. SOME/IP messages are sent as TCP/UDP unicast/multicast packets, but it is also possible to use local (Unix) endpoints. + +SOME/IP feeder is [COVESA / vsomeip](https://github.com/COVESA/vsomeip/) application, that subscribes for specific "Wiper" SOME/IP Events, parses the payload and feeds values to KUKSA Databroker. It also provides an example "Wiper" SOME/IP request handling for setting wiper parameters. + +### Module summary +- [src/someip_feeder/](./src/someip_feeder/) is the main SOME/IP to KUKSA Databroker adapter. +- [src/lib/broker_feeder/](./src/lib/broker_feeder/) is provinding KUKSA Databroker integration. +- [src/lib/someip_client/](./src/lib/someip_client/) is provinding generic SOME/IP Client implementation (generic implementation, does not depend on wiper). +- [src/lib/wiper_poc/](./src/lib/wiper_poc/) is provinding wiper specific implementation (someip config, serialization, deserialization of events and data structures).\ +**NOTE**: Check [wiper_poc.h](src/lib/wiper_poc/wiper_poc.h) for SOME/IP Event definitions (`struct t_Event`), and SOME/IP Request (`struct t_WiperRequest`) +- [src/examples/wiper_service/wiper_server.cc](./src/examples/wiper_service/wiper_server.cc): an example SOME/IP Wiper Service for sending some serialized example Wiper events. +- [src/examples/wiper_service/wiper_client.cc](./src/examples/wiper_service/wiper_client.cc): an example SOME/IP Wiper Client for subscribing and parsing Wiper event payload and example Request/Response client for Wiper VSS service. +- [src/examples/wiper_service/wiper_sim.cc](./src/examples/wiper_service/wiper_sim.cc): an example simulation of a Wiper service. +- [patches/](./patches/): Contains vsomeip patches (master branch), that have not been pushed to upstream yet. + +## Setup Development environment + +### Prerequisites + +1. Install cmake and build requirements + ``` bash + sudo apt-get install -y cmake g++ build-essential g++-aarch64-linux-gnu binutils-aarch64-linux-gnu jq + ``` +1. Install and configure conan (if needed) + ``` bash + sudo apt-get install -y python3 python3-pip + pip3 install "conan==1.55" + ``` + **NOTE:** Sometimes latest conan recipe revisions are broken, but the local build succeeds using cached older revision. If build fails on CI local conan cache could be cleared to reproduce the error. Also latest recipes may require newer conan version. + ``` bash + rm -rf ~/.conan/data + pip3 install "conan==1.*" + ``` + Last known working revisions are hardcoded in [conanfile.txt](./conanfile.txt) [requires]. +1. Install [VS Code](https://code.visualstudio.com/download). To setup proper conan environment in vs code, launch vscode using: + ``` bash + ./vscode-conan.sh + ``` +1. Install and start recent KUKSA Databroker: + ``` bash + docker run --rm -it -p 55555:55555/tcp --name databroker ghcr.io/eclipse/kuksa.val/databroker:master + ``` + +### Building KUKSA SOME/IP Provider + +There are scripts for building release and debug versions of someip provider, supporting `x86_64`, `aarch64` or `rpi` architectures: + +``` bash +./build-release.sh +``` +**NOTE:** Use `rpi` when building on a Raspberry Pi. +Scripts generate `can-provider__.tar` archives. + +There is also a script for exporting OCI container images (or import them locally for testing): +``` +./docker-build.sh [OPTIONS] TARGETS + +Standalone build helper for someip-feeder container. + +OPTIONS: + -l, --local local docker import (does not export tar) + -v, --verbose enable plain docker output and disable cache + --help show help + +TARGETS: + x86_64|amd64, aarch64|amd64 Target arch to build for, if not set - defaults to multiarch +``` +**NOTE:** This script can't handle multi-arch images! + +## Configuration + +vsomeip requires a combination of json config file + environment variables + +### vsomeip specific Configuration + +vsomeip library uses a combination of environment variables and config json files that must be set correctly or binaries won't work. +You can test vsomeip services in a "local" mode (running on a single Linux host, using Unix sockets for communication) or in "normal" mode, where 2 different hosts are required (e.g. wiper service running on the 1st host and KUKSA SOME/IP Provider running on the 2nd host). + +**NOTE:** Multicast config (`service-discovery`) for both services must be matching and multicast packages between the hosts must be enabled, also unicast messages between hosts must be possible (both hosts in the same network). + +#### Environment variables for vsomeip +- `VSOMEIP_CONFIGURATION`: path to vsomeip config json file. +- `VSOMEIP_APPLICATION_NAME`: vsomeip application name, must be consistent with json config file `.applications[].name` + +**NOTE**: Those variables are already set (and validated) in provided `./bin/setup-*.sh` scripts. + +#### Wiper configuration files +- Wiper Service Config: [config/someip_wiper_service.json](./config/someip_wiper_service.json) +- Wiper Client Config: [config/someip_wiper_client.json](./config/someip_wiper_client.json) +- Wiper Client Config (Proxy) [config/someip_wiper_client-proxy.json](./config/someip_wiper_client-proxy.json) +- Someip Feeder Config: [config/someip_feeder.json](./config/someip_feeder.json) +- Someip Feeder Config (Proxy): [config/someip_feeder-proxy.json](./config/someip_feeder-proxy.json) + +**NOTE**: With vsomeip it is not possible to have multiple routing applications running on the same host, so in Proxy setup, Wiper service is configured as routing app and Proxy clients are configured to route through Wiper Service. +In case two hosts (VMs) are available, Proxy configs are not needed, then one host should run the service and the other - client config. + +#### Config file modifications +In order to use non-proxy mode on 2 network hosts, you have to modify the `.unicast` address in vsomeip config file, unfortunately it does not support hostnames, so there are some helper scripts for setting up the environment and replacing hostnames with `jq` +- Environment setup for Wiper Service: [./bin/setup-wiper-service.sh](./bin/setup-wiper-service.sh) +- Environment setup for Wiper Client: [./bin/setup-someip2val.sh](./bin/setup-someip2val.sh) +- Environment setup for Wiper Client (Proxy): [./bin/setup-someip2val-proxy.sh](./bin/setup-someip2val-proxy.sh) + + +## Runing someip example and KUKSA SOME/IP Provider + +Setup scripts in `./bin` are meant to run from install directory, e.g. +after executing `./build-debug.sh` it is: `target/x86_64/debug/install/bin`. + +If running from another location, make sure your `LD_LIBRARY_PATH` includes vsomeip3 binaries. +### Local mode (single host) +In this mode only Unix sockets are used, wiper service is acting as a someip router app and KUKSA SOME/IP Provider is a proxy. + +- Launch wiper service from install directory: +``` bash +. ./setup-wiper-service.sh +./wiper_service --cycle 300 +``` +- Launch KUKSA SOME/IP Provider in proxy mode: +``` bash +. ./setup-someip2val-proxy.sh +./someip_feeder +``` +### UDP mode (2 hosts) +In this mode you need another host in your network to run the service. + +- Launch wiper service from install directory on Host2: +``` bash +. ./setup-wiper-service.sh +./wiper_service --cycle 300 +``` +- Launch KUKSA SOME/IP provider in default mode: +``` bash +. ./setup-someip2val.sh +./someip_feeder +``` + +Make sure you have `jq` installed as it is rewriting config files to update unicast address. + +## Extending KUKSA SOME/IP Provider + +Provided wiper example needs to be adjusted for another someip service events. + +- `SomeIPClient` class provides generic event subscription and passes someip payload to a custom callback: +``` c++ +typedef std::function < + int (vsomeip::service_t service, vsomeip::instance_t instance, vsomeip::method_t event, + const uint8_t *payload, size_t size) +> message_callback_t; +``` +- `SomeIPConfig` vsomeip service/instance/event_group/event values also have to be changed (e.g. via environment variables, or in code) +- `SomeipFeederAdapter::on_someip_message()` : Example for someip payload callback, deserializing payload and feeding to Databroker + +## Running KUKSA SOME/IP Provider with Authorization + +Authorization support and example setup is described [here](./cert/README.md). -Name | Description ----- | ----------- -[GPS Provider](https://github.com/eclipse-kuksa/kuksa-gps-provider) | GPS data source for KUKSA.val Server and KUKSA.val Databroker *- NOTE: Moved to new repo!* -[CAN Provider (DBC feeder)](https://github.com/eclipse-kuksa/kuksa-can-provider) | DBC feeder for for KUKSA.val Server and KUKSA.val Databroker *- NOTE: Moved to new repo!* -[SOME/IP feeder](./someip2val) | SOME/IP feeder for KUKSA.val Databroker -[DDS Provider](https://github.com/eclipse-kuksa/kuksa-dds-provider) | DDS provider for KUKSA.val Databroker *- NOTE: Moved to new repo!* -[Replay](./replay) | KUKSA.val Server replay script for previously recorded files, created by providing KUKSA.val Server with `--record` argument -[CSV provider](./csv_provider) | Script to replay VSS signals to KUKSA.val Databroker as defined in a CSV-file ## Pre-commit set up + This repository is set up to use [pre-commit](https://pre-commit.com/) hooks. Use `pip install pre-commit` to install pre-commit. After you clone the project, run `pre-commit install` to install pre-commit into your git hooks. diff --git a/someip2val/bin/network-setup.sh b/bin/network-setup.sh similarity index 100% rename from someip2val/bin/network-setup.sh rename to bin/network-setup.sh diff --git a/someip2val/bin/setup-someip2val-proxy.sh b/bin/setup-someip2val-proxy.sh similarity index 100% rename from someip2val/bin/setup-someip2val-proxy.sh rename to bin/setup-someip2val-proxy.sh diff --git a/someip2val/bin/setup-someip2val.sh b/bin/setup-someip2val.sh similarity index 100% rename from someip2val/bin/setup-someip2val.sh rename to bin/setup-someip2val.sh diff --git a/someip2val/bin/setup-wiper-client-proxy.sh b/bin/setup-wiper-client-proxy.sh similarity index 100% rename from someip2val/bin/setup-wiper-client-proxy.sh rename to bin/setup-wiper-client-proxy.sh diff --git a/someip2val/bin/setup-wiper-client.sh b/bin/setup-wiper-client.sh similarity index 100% rename from someip2val/bin/setup-wiper-client.sh rename to bin/setup-wiper-client.sh diff --git a/someip2val/bin/setup-wiper-service.sh b/bin/setup-wiper-service.sh similarity index 100% rename from someip2val/bin/setup-wiper-service.sh rename to bin/setup-wiper-service.sh diff --git a/someip2val/bin/someip2val-docker.sh b/bin/someip2val-docker.sh similarity index 100% rename from someip2val/bin/someip2val-docker.sh rename to bin/someip2val-docker.sh diff --git a/someip2val/build-debug.sh b/build-debug.sh similarity index 100% rename from someip2val/build-debug.sh rename to build-debug.sh diff --git a/someip2val/build-release.sh b/build-release.sh similarity index 100% rename from someip2val/build-release.sh rename to build-release.sh diff --git a/someip2val/cert/.gitignore b/cert/.gitignore similarity index 100% rename from someip2val/cert/.gitignore rename to cert/.gitignore diff --git a/someip2val/cert/README.md b/cert/README.md similarity index 100% rename from someip2val/cert/README.md rename to cert/README.md diff --git a/someip2val/cert/someip2val.json b/cert/someip2val.json similarity index 100% rename from someip2val/cert/someip2val.json rename to cert/someip2val.json diff --git a/someip2val/cert/someip2val.token b/cert/someip2val.token similarity index 100% rename from someip2val/cert/someip2val.token rename to cert/someip2val.token diff --git a/someip2val/conanfile.txt b/conanfile.txt similarity index 100% rename from someip2val/conanfile.txt rename to conanfile.txt diff --git a/someip2val/config/someip_feeder-proxy.json b/config/someip_feeder-proxy.json similarity index 100% rename from someip2val/config/someip_feeder-proxy.json rename to config/someip_feeder-proxy.json diff --git a/someip2val/config/someip_feeder.json b/config/someip_feeder.json similarity index 100% rename from someip2val/config/someip_feeder.json rename to config/someip_feeder.json diff --git a/someip2val/config/someip_wiper_client-proxy.json b/config/someip_wiper_client-proxy.json similarity index 100% rename from someip2val/config/someip_wiper_client-proxy.json rename to config/someip_wiper_client-proxy.json diff --git a/someip2val/config/someip_wiper_client.json b/config/someip_wiper_client.json similarity index 100% rename from someip2val/config/someip_wiper_client.json rename to config/someip_wiper_client.json diff --git a/someip2val/config/someip_wiper_service.json b/config/someip_wiper_service.json similarity index 100% rename from someip2val/config/someip_wiper_service.json rename to config/someip_wiper_service.json diff --git a/someip2val/docker-build.sh b/docker-build.sh similarity index 100% rename from someip2val/docker-build.sh rename to docker-build.sh diff --git a/someip2val/docker/Dockerfile b/docker/Dockerfile similarity index 100% rename from someip2val/docker/Dockerfile rename to docker/Dockerfile diff --git a/someip2val/docker/README.md b/docker/README.md similarity index 100% rename from someip2val/docker/README.md rename to docker/README.md diff --git a/someip2val/docker/docker-build.sh b/docker/docker-build.sh similarity index 100% rename from someip2val/docker/docker-build.sh rename to docker/docker-build.sh diff --git a/someip2val/docker/docker-run-client.sh b/docker/docker-run-client.sh similarity index 100% rename from someip2val/docker/docker-run-client.sh rename to docker/docker-run-client.sh diff --git a/someip2val/docker/docker-run-service.sh b/docker/docker-run-service.sh similarity index 100% rename from someip2val/docker/docker-run-service.sh rename to docker/docker-run-service.sh diff --git a/someip2val/docker/vsomeip/CMakeLists.txt b/docker/vsomeip/CMakeLists.txt similarity index 100% rename from someip2val/docker/vsomeip/CMakeLists.txt rename to docker/vsomeip/CMakeLists.txt diff --git a/someip2val/docker/vsomeip/config/docker-notify-client.json b/docker/vsomeip/config/docker-notify-client.json similarity index 100% rename from someip2val/docker/vsomeip/config/docker-notify-client.json rename to docker/vsomeip/config/docker-notify-client.json diff --git a/someip2val/docker/vsomeip/config/docker-notify-service.json b/docker/vsomeip/config/docker-notify-service.json similarity index 100% rename from someip2val/docker/vsomeip/config/docker-notify-service.json rename to docker/vsomeip/config/docker-notify-service.json diff --git a/someip2val/docker/vsomeip/config/notify-client.json b/docker/vsomeip/config/notify-client.json similarity index 100% rename from someip2val/docker/vsomeip/config/notify-client.json rename to docker/vsomeip/config/notify-client.json diff --git a/someip2val/docker/vsomeip/config/notify-service.json b/docker/vsomeip/config/notify-service.json similarity index 100% rename from someip2val/docker/vsomeip/config/notify-service.json rename to docker/vsomeip/config/notify-service.json diff --git a/someip2val/docker/vsomeip/examples/run-client.sh b/docker/vsomeip/examples/run-client.sh similarity index 100% rename from someip2val/docker/vsomeip/examples/run-client.sh rename to docker/vsomeip/examples/run-client.sh diff --git a/someip2val/docker/vsomeip/examples/run-service.sh b/docker/vsomeip/examples/run-service.sh similarity index 100% rename from someip2val/docker/vsomeip/examples/run-service.sh rename to docker/vsomeip/examples/run-service.sh diff --git a/someip2val/docker/vsomeip/examples/setup-routing.sh b/docker/vsomeip/examples/setup-routing.sh similarity index 100% rename from someip2val/docker/vsomeip/examples/setup-routing.sh rename to docker/vsomeip/examples/setup-routing.sh diff --git a/someip2val/patches/000-cmake-reduce-gcc-warnings.patch b/patches/000-cmake-reduce-gcc-warnings.patch similarity index 100% rename from someip2val/patches/000-cmake-reduce-gcc-warnings.patch rename to patches/000-cmake-reduce-gcc-warnings.patch diff --git a/someip2val/patches/001-vsomeip-logger-fixes.patch b/patches/001-vsomeip-logger-fixes.patch similarity index 100% rename from someip2val/patches/001-vsomeip-logger-fixes.patch rename to patches/001-vsomeip-logger-fixes.patch diff --git a/someip2val/patches/002-vsomeip-default-major-change.patch b/patches/002-vsomeip-default-major-change.patch similarity index 100% rename from someip2val/patches/002-vsomeip-default-major-change.patch rename to patches/002-vsomeip-default-major-change.patch diff --git a/someip2val/patches/003-vsomeip-application-debugs.patch b/patches/003-vsomeip-application-debugs.patch similarity index 100% rename from someip2val/patches/003-vsomeip-application-debugs.patch rename to patches/003-vsomeip-application-debugs.patch diff --git a/someip2val/proto/kuksa_data_broker/kuksa/val/v1/types.proto b/proto/kuksa_data_broker/kuksa/val/v1/types.proto similarity index 100% rename from someip2val/proto/kuksa_data_broker/kuksa/val/v1/types.proto rename to proto/kuksa_data_broker/kuksa/val/v1/types.proto diff --git a/someip2val/proto/kuksa_data_broker/kuksa/val/v1/val.proto b/proto/kuksa_data_broker/kuksa/val/v1/val.proto similarity index 100% rename from someip2val/proto/kuksa_data_broker/kuksa/val/v1/val.proto rename to proto/kuksa_data_broker/kuksa/val/v1/val.proto diff --git a/someip2val/proto/kuksa_data_broker/sdv/databroker/v1/broker.proto b/proto/kuksa_data_broker/sdv/databroker/v1/broker.proto similarity index 100% rename from someip2val/proto/kuksa_data_broker/sdv/databroker/v1/broker.proto rename to proto/kuksa_data_broker/sdv/databroker/v1/broker.proto diff --git a/someip2val/proto/kuksa_data_broker/sdv/databroker/v1/collector.proto b/proto/kuksa_data_broker/sdv/databroker/v1/collector.proto similarity index 100% rename from someip2val/proto/kuksa_data_broker/sdv/databroker/v1/collector.proto rename to proto/kuksa_data_broker/sdv/databroker/v1/collector.proto diff --git a/someip2val/proto/kuksa_data_broker/sdv/databroker/v1/types.proto b/proto/kuksa_data_broker/sdv/databroker/v1/types.proto similarity index 100% rename from someip2val/proto/kuksa_data_broker/sdv/databroker/v1/types.proto rename to proto/kuksa_data_broker/sdv/databroker/v1/types.proto diff --git a/someip2val/README.md b/someip2val/README.md deleted file mode 100644 index ff1b3cc..0000000 --- a/someip2val/README.md +++ /dev/null @@ -1,182 +0,0 @@ -- [SOME/IP integration in Docker containers](#someip-integration-in-docker-containers) -- [SOME/IP to Kuksa.VAL Feeder](#someip-to-kuksaval-feeder) - - [Overview](#overview) - - [Module summary](#module-summary) - - [Setup Development environment](#setup-development-environment) - - [Prerequisites](#prerequisites) - - [Building someip2val](#building-someip2val) - - [Configuration](#configuration) - - [vsomeip specific Configuration](#vsomeip-specific-configuration) - - [Environment variables for vsomeip](#environment-variables-for-vsomeip) - - [Wiper configuration files](#wiper-configuration-files) - - [Config file modifications](#config-file-modifications) - - [Runing someip example and someip2val feeder](#runing-someip-example-and-someip2val-feeder) - - [Local mode (single host)](#local-mode-single-host) - - [UDP mode (2 hosts)](#udp-mode-2-hosts) - - [Extending someip2val feeder](#extending-someip2val-feeder) - - [Running someip2val with Authorization](#running-someip2val-with-authorization) - -# SOME/IP integration in Docker containers - -Running default vsomeip examples in containers is described in details [here](docker/README.md) - -# SOME/IP to Kuksa.VAL Feeder - -## Overview - -[SOME/IP](https://www.autosar.org/fileadmin/standards/R22-11/FO/AUTOSAR_PRS_SOMEIPProtocol.pdf) is an automotive communication protocol which supports remote procedure calls, event notifications, service discovery. SOME/IP messages are sent as TCP/UDP unicast/multicast packets, but it is also possible to use local (Unix) endpoints. - -SOME/IP feeder is [COVESA / vsomeip](https://github.com/COVESA/vsomeip/) application, that subscribes for specific "Wiper" SOME/IP Events, parses the payload and feeds values to KUKSA.VAL Databroker. It also provides an example "Wiper" SOME/IP request handling for setting wiper parameters. - -## Module summary -- [src/someip_feeder/](./src/someip_feeder/) is the main SOME/IP to KUKSA.VAL Databroker adapter. -- [src/lib/broker_feeder/](./src/lib/broker_feeder/) is provinding KUKSA.VAL Databroker integration. -- [src/lib/someip_client/](./src/lib/someip_client/) is provinding generic SOME/IP Client implementation (generic implementation, does not depend on wiper). -- [src/lib/wiper_poc/](./src/lib/wiper_poc/) is provinding wiper specific implementation (someip config, serialization, deserialization of events and data structures).\ -**NOTE**: Check [wiper_poc.h](src/lib/wiper_poc/wiper_poc.h) for SOME/IP Event definitions (`struct t_Event`), and SOME/IP Request (`struct t_WiperRequest`) -- [src/examples/wiper_service/wiper_server.cc](./src/examples/wiper_service/wiper_server.cc): an example SOME/IP Wiper Service for sending some serialized example Wiper events. -- [src/examples/wiper_service/wiper_client.cc](./src/examples/wiper_service/wiper_client.cc): an example SOME/IP Wiper Client for subscribing and parsing Wiper event payload and example Request/Response client for Wiper VSS service. -- [src/examples/wiper_service/wiper_sim.cc](./src/examples/wiper_service/wiper_sim.cc): an example simulation of a Wiper service. -- [patches/](./patches/): Contains vsomeip patches (master branch), that have not been pushed to upstream yet. - -## Setup Development environment - -### Prerequisites - -1. Install cmake and build requirements - ``` bash - sudo apt-get install -y cmake g++ build-essential g++-aarch64-linux-gnu binutils-aarch64-linux-gnu jq - ``` -1. Install and configure conan (if needed) - ``` bash - sudo apt-get install -y python3 python3-pip - pip3 install "conan==1.55" - ``` - **NOTE:** Sometimes latest conan recipe revisions are broken, but the local build succeeds using cached older revision. If build fails on CI local conan cache could be cleared to reproduce the error. Also latest recipes may require newer conan version. - ``` bash - rm -rf ~/.conan/data - pip3 install "conan==1.*" - ``` - Last known working revisions are hardcoded in [conanfile.txt](./conanfile.txt) [requires]. -1. Install [VS Code](https://code.visualstudio.com/download). To setup proper conan environment in vs code, launch vscode using: - ``` bash - ./vscode-conan.sh - ``` -1. Install and start recent KUKSA Databroker: - ``` bash - docker run --rm -it -p 55555:55555/tcp --name databroker ghcr.io/eclipse/kuksa.val/databroker:master - ``` - -### Building someip2val - -There are scripts for building release and debug versions of someip2val feeder, supporting `x86_64`, `aarch64` or `rpi` architectures: - -``` bash -cd someip2val -./build-release.sh -``` -**NOTE:** Use `rpi` when building on a Raspberry Pi. -Scripts generate `someip2val--.tar` archives. - -There is also a script for exporting OCI container images (or import them locally for testing): -``` -./docker-build.sh [OPTIONS] TARGETS - -Standalone build helper for someip-feeder container. - -OPTIONS: - -l, --local local docker import (does not export tar) - -v, --verbose enable plain docker output and disable cache - --help show help - -TARGETS: - x86_64|amd64, aarch64|amd64 Target arch to build for, if not set - defaults to multiarch -``` -**NOTE:** This script can't handle multi-arch images! - -## Configuration - -vsomeip requires a combination of json config file + environment variables - -### vsomeip specific Configuration - -vsomeip library uses a combination of environment variables and config json files that must be set correctly or binaries won't work. -You can test vsomeip services in a "local" mode (running on a single Linux host, using Unix sockets for communication) or in "normal" mode, where 2 different hosts are required (e.g. wiper service running on the 1st host and someip2val feeder running on the 2nd host). - -**NOTE:** Multicast config (`service-discovery`) for both services must be matching and multicast packages between the hosts must be enabled, also unicast messages between hosts must be possible (both hosts in the same network). - -#### Environment variables for vsomeip -- `VSOMEIP_CONFIGURATION`: path to vsomeip config json file. -- `VSOMEIP_APPLICATION_NAME`: vsomeip application name, must be consistent with json config file `.applications[].name` - -**NOTE**: Those variables are already set (and validated) in provided `./bin/setup-*.sh` scripts. - -#### Wiper configuration files -- Wiper Service Config: [config/someip_wiper_service.json](./config/someip_wiper_service.json) -- Wiper Client Config: [config/someip_wiper_client.json](./config/someip_wiper_client.json) -- Wiper Client Config (Proxy) [config/someip_wiper_client-proxy.json](./config/someip_wiper_client-proxy.json) -- Someip Feeder Config: [config/someip_feeder.json](./config/someip_feeder.json) -- Someip Feeder Config (Proxy): [config/someip_feeder-proxy.json](./config/someip_feeder-proxy.json) - -**NOTE**: With vsomeip it is not possible to have multiple routing applications running on the same host, so in Proxy setup, Wiper service is configured as routing app and Proxy clients are configured to route through Wiper Service. -In case two hosts (VMs) are available, Proxy configs are not needed, then one host should run the service and the other - client config. - -#### Config file modifications -In order to use non-proxy mode on 2 network hosts, you have to modify the `.unicast` address in vsomeip config file, unfortunately it does not support hostnames, so there are some helper scripts for setting up the environment and replacing hostnames with `jq` -- Environment setup for Wiper Service: [./bin/setup-wiper-service.sh](./bin/setup-wiper-service.sh) -- Environment setup for Wiper Client: [./bin/setup-someip2val.sh](./bin/setup-someip2val.sh) -- Environment setup for Wiper Client (Proxy): [./bin/setup-someip2val-proxy.sh](./bin/setup-someip2val-proxy.sh) - - -## Runing someip example and someip2val feeder - -Setup scripts in `./bin` are meant to run from install directory, e.g. -after executing `./build-debug.sh` it is: `target/x86_64/debug/install/bin`. - -If running from another location, make sure your `LD_LIBRARY_PATH` includes vsomeip3 binaries. -### Local mode (single host) -In this mode only Unix sockets are used, wiper service is acting as a someip router app and someip2val feeder is a proxy. - -- Launch wiper service from install directory: -``` bash -. ./setup-wiper-service.sh -./wiper_service --cycle 300 -``` -- Launch someip2val feeder in proxy mode: -``` bash -. ./setup-someip2val-proxy.sh -./someip_feeder -``` -### UDP mode (2 hosts) -In this mode you need another host in your network to run the service. - -- Launch wiper service from install directory on Host2: -``` bash -. ./setup-wiper-service.sh -./wiper_service --cycle 300 -``` -- Launch someip2val feeder in default mode: -``` bash -. ./setup-someip2val.sh -./someip_feeder -``` - -Make sure you have `jq` installed as it is rewriting config files to update unicast address. - -## Extending someip2val feeder - -Provided wiper example needs to be adjusted for another someip service events. - -- `SomeIPClient` class provides generic event subscription and passes someip payload to a custom callback: -``` c++ -typedef std::function < - int (vsomeip::service_t service, vsomeip::instance_t instance, vsomeip::method_t event, - const uint8_t *payload, size_t size) -> message_callback_t; -``` -- `SomeIPConfig` vsomeip service/instance/event_group/event values also have to be changed (e.g. via environment variables, or in code) -- `SomeipFeederAdapter::on_someip_message()` : Example for someip payload callback, deserializing payload and feeding to Databroker - -## Running someip2val with Authorization - -Authorization support and example setup is described [here](./cert/README.md). diff --git a/someip2val/src/CMakeLists.txt b/src/CMakeLists.txt similarity index 100% rename from someip2val/src/CMakeLists.txt rename to src/CMakeLists.txt diff --git a/someip2val/src/examples/wiper_service/CMakeLists.txt b/src/examples/wiper_service/CMakeLists.txt similarity index 100% rename from someip2val/src/examples/wiper_service/CMakeLists.txt rename to src/examples/wiper_service/CMakeLists.txt diff --git a/someip2val/src/examples/wiper_service/wiper_client.cc b/src/examples/wiper_service/wiper_client.cc similarity index 100% rename from someip2val/src/examples/wiper_service/wiper_client.cc rename to src/examples/wiper_service/wiper_client.cc diff --git a/someip2val/src/examples/wiper_service/wiper_server.cc b/src/examples/wiper_service/wiper_server.cc similarity index 100% rename from someip2val/src/examples/wiper_service/wiper_server.cc rename to src/examples/wiper_service/wiper_server.cc diff --git a/someip2val/src/examples/wiper_service/wiper_sim.cc b/src/examples/wiper_service/wiper_sim.cc similarity index 100% rename from someip2val/src/examples/wiper_service/wiper_sim.cc rename to src/examples/wiper_service/wiper_sim.cc diff --git a/someip2val/src/examples/wiper_service/wiper_sim.h b/src/examples/wiper_service/wiper_sim.h similarity index 100% rename from someip2val/src/examples/wiper_service/wiper_sim.h rename to src/examples/wiper_service/wiper_sim.h diff --git a/someip2val/src/lib/broker_feeder/CMakeLists.txt b/src/lib/broker_feeder/CMakeLists.txt similarity index 100% rename from someip2val/src/lib/broker_feeder/CMakeLists.txt rename to src/lib/broker_feeder/CMakeLists.txt diff --git a/someip2val/src/lib/broker_feeder/actuator_subscriber.cc b/src/lib/broker_feeder/actuator_subscriber.cc similarity index 100% rename from someip2val/src/lib/broker_feeder/actuator_subscriber.cc rename to src/lib/broker_feeder/actuator_subscriber.cc diff --git a/someip2val/src/lib/broker_feeder/actuator_subscriber.h b/src/lib/broker_feeder/actuator_subscriber.h similarity index 100% rename from someip2val/src/lib/broker_feeder/actuator_subscriber.h rename to src/lib/broker_feeder/actuator_subscriber.h diff --git a/someip2val/src/lib/broker_feeder/collector_client.cc b/src/lib/broker_feeder/collector_client.cc similarity index 100% rename from someip2val/src/lib/broker_feeder/collector_client.cc rename to src/lib/broker_feeder/collector_client.cc diff --git a/someip2val/src/lib/broker_feeder/collector_client.h b/src/lib/broker_feeder/collector_client.h similarity index 100% rename from someip2val/src/lib/broker_feeder/collector_client.h rename to src/lib/broker_feeder/collector_client.h diff --git a/someip2val/src/lib/broker_feeder/create_datapoint.h b/src/lib/broker_feeder/create_datapoint.h similarity index 100% rename from someip2val/src/lib/broker_feeder/create_datapoint.h rename to src/lib/broker_feeder/create_datapoint.h diff --git a/someip2val/src/lib/broker_feeder/data_broker_feeder.cc b/src/lib/broker_feeder/data_broker_feeder.cc similarity index 100% rename from someip2val/src/lib/broker_feeder/data_broker_feeder.cc rename to src/lib/broker_feeder/data_broker_feeder.cc diff --git a/someip2val/src/lib/broker_feeder/data_broker_feeder.h b/src/lib/broker_feeder/data_broker_feeder.h similarity index 100% rename from someip2val/src/lib/broker_feeder/data_broker_feeder.h rename to src/lib/broker_feeder/data_broker_feeder.h diff --git a/someip2val/src/lib/broker_feeder/simple_log.h b/src/lib/broker_feeder/simple_log.h similarity index 100% rename from someip2val/src/lib/broker_feeder/simple_log.h rename to src/lib/broker_feeder/simple_log.h diff --git a/someip2val/src/lib/someip_client/CMakeLists.txt b/src/lib/someip_client/CMakeLists.txt similarity index 100% rename from someip2val/src/lib/someip_client/CMakeLists.txt rename to src/lib/someip_client/CMakeLists.txt diff --git a/someip2val/src/lib/someip_client/sample_ids.h b/src/lib/someip_client/sample_ids.h similarity index 100% rename from someip2val/src/lib/someip_client/sample_ids.h rename to src/lib/someip_client/sample_ids.h diff --git a/someip2val/src/lib/someip_client/someip_client.cc b/src/lib/someip_client/someip_client.cc similarity index 100% rename from someip2val/src/lib/someip_client/someip_client.cc rename to src/lib/someip_client/someip_client.cc diff --git a/someip2val/src/lib/someip_client/someip_client.h b/src/lib/someip_client/someip_client.h similarity index 100% rename from someip2val/src/lib/someip_client/someip_client.h rename to src/lib/someip_client/someip_client.h diff --git a/someip2val/src/lib/wiper_poc/CMakeLists.txt b/src/lib/wiper_poc/CMakeLists.txt similarity index 100% rename from someip2val/src/lib/wiper_poc/CMakeLists.txt rename to src/lib/wiper_poc/CMakeLists.txt diff --git a/someip2val/src/lib/wiper_poc/wiper-ids.h b/src/lib/wiper_poc/wiper-ids.h similarity index 100% rename from someip2val/src/lib/wiper_poc/wiper-ids.h rename to src/lib/wiper_poc/wiper-ids.h diff --git a/someip2val/src/lib/wiper_poc/wiper_poc.cc b/src/lib/wiper_poc/wiper_poc.cc similarity index 100% rename from someip2val/src/lib/wiper_poc/wiper_poc.cc rename to src/lib/wiper_poc/wiper_poc.cc diff --git a/someip2val/src/lib/wiper_poc/wiper_poc.h b/src/lib/wiper_poc/wiper_poc.h similarity index 100% rename from someip2val/src/lib/wiper_poc/wiper_poc.h rename to src/lib/wiper_poc/wiper_poc.h diff --git a/someip2val/src/someip_feeder/CMakeLists.txt b/src/someip_feeder/CMakeLists.txt similarity index 100% rename from someip2val/src/someip_feeder/CMakeLists.txt rename to src/someip_feeder/CMakeLists.txt diff --git a/someip2val/src/someip_feeder/main.cc b/src/someip_feeder/main.cc similarity index 100% rename from someip2val/src/someip_feeder/main.cc rename to src/someip_feeder/main.cc diff --git a/someip2val/src/someip_feeder/someip_kuksa_adapter.cc b/src/someip_feeder/someip_kuksa_adapter.cc similarity index 100% rename from someip2val/src/someip_feeder/someip_kuksa_adapter.cc rename to src/someip_feeder/someip_kuksa_adapter.cc diff --git a/someip2val/src/someip_feeder/someip_kuksa_adapter.h b/src/someip_feeder/someip_kuksa_adapter.h similarity index 100% rename from someip2val/src/someip_feeder/someip_kuksa_adapter.h rename to src/someip_feeder/someip_kuksa_adapter.h diff --git a/someip2val/toolchains/target_aarch64_Debug b/toolchains/target_aarch64_Debug similarity index 100% rename from someip2val/toolchains/target_aarch64_Debug rename to toolchains/target_aarch64_Debug diff --git a/someip2val/toolchains/target_aarch64_Release b/toolchains/target_aarch64_Release similarity index 100% rename from someip2val/toolchains/target_aarch64_Release rename to toolchains/target_aarch64_Release diff --git a/someip2val/toolchains/target_rpi_Debug b/toolchains/target_rpi_Debug similarity index 100% rename from someip2val/toolchains/target_rpi_Debug rename to toolchains/target_rpi_Debug diff --git a/someip2val/toolchains/target_rpi_Release b/toolchains/target_rpi_Release similarity index 100% rename from someip2val/toolchains/target_rpi_Release rename to toolchains/target_rpi_Release diff --git a/someip2val/toolchains/target_x86_64_Debug b/toolchains/target_x86_64_Debug similarity index 100% rename from someip2val/toolchains/target_x86_64_Debug rename to toolchains/target_x86_64_Debug diff --git a/someip2val/toolchains/target_x86_64_Release b/toolchains/target_x86_64_Release similarity index 100% rename from someip2val/toolchains/target_x86_64_Release rename to toolchains/target_x86_64_Release diff --git a/someip2val/vscode-conan.sh b/vscode-conan.sh similarity index 100% rename from someip2val/vscode-conan.sh rename to vscode-conan.sh