Skip to content

Commit

Permalink
SOME/IP Provider Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbosch committed Feb 7, 2024
1 parent 50f4e1d commit 02744bc
Show file tree
Hide file tree
Showing 87 changed files with 212 additions and 217 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/check_license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
196 changes: 185 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <arch>
```
**NOTE:** Use `rpi` when building on a Raspberry Pi.
Scripts generate `can-provider_<arch>_<debug|release>.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.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 02744bc

Please sign in to comment.