|
1 |
| -# Kuksa Feeders |
| 1 | +# KUKSA CSV Provider |
| 2 | + |
2 | 3 | 
|
3 | 4 |
|
4 |
| -This are data feeders for VSS based systems. The feeders here work with [KUKSA.val](https://github.com/eclipse/kuksa.val) |
| 5 | +The aim of this script is to provide and replay VSS data into a [KUKSA Databroker](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker). |
| 6 | +Therefore, it takes a CSV-file, containting pre-defined sequences of VSS signals including timing delays, and provides it to the KUKSA Databroker. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +The provider requires an installation of Python in version 3 and can be executed with the following commands: |
| 11 | + |
| 12 | +``` |
| 13 | +pip install -r requirements.txt |
| 14 | +python3 provider.py |
| 15 | +``` |
| 16 | + |
| 17 | +This assumes a running KUKSA Databroker at `127.0.0.1:55555` and a file named `signals.csv` containing the signals to apply. See the section [Arguments](#arguments) for more details on possible arguments and default values. |
| 18 | + |
| 19 | +The provider uses the [kuksa_client]() Python implementation which you need to install on your system, e.g., by applying the [requirement.txt](requirements.txt) with pip. |
| 20 | + |
| 21 | +## Arguments |
| 22 | + |
| 23 | +You can start the provider with the following arguments on a command line: |
| 24 | + |
| 25 | +| short argument | long argument | environment variable | description | default value | |
| 26 | +|---- | ---- | ---- |----- | ----| |
| 27 | +|-f| --file | PROVIDER_SIGNALS_FILE | This indicates the CSV-file containing the signals to update in the KUKSA Databroker. | signals.csv | |
| 28 | +| -a | --address | KUKSA_DATA_BROKER_ADDR | This indicates the address of KUKSA Databroker to connect to. | 127.0.0.1 | |
| 29 | +| -p | --port | KUKSA_DATA_BROKER_PORT | This indicates the port of the KUKSA Databroker to connect to. | 55555 | |
| 30 | +| -i | --infinite | PROVIDER_INFINITE | If the flag is set, the provider loops over the file until stopped, otherwise the file gets processed once. | not present/False |
| 31 | +| -l | --log | PROVIDER_LOG_LEVEL | This sets the logging level. Possible values are: DEBUG, INFO, DEBUG, WARNING, ERROR, CRITICAL | WARNING |
| 32 | +| | --cacertificate | - | Path to root CA. If defined the client will attempt to use a secure connection and identify the server using this certificate. | None |
| 33 | +| | --tls-server-name | - | TLS server name, may be needed if addressing a server by IP-name. | None |
| 34 | + |
| 35 | +## CSV File |
| 36 | + |
| 37 | +An example CSV-files is available in [signals.csv](signals.csv) where an example line is: |
| 38 | + |
| 39 | +``` |
| 40 | +current,Vehicle.Speed,48,1 |
| 41 | +``` |
| 42 | + |
| 43 | +The delimiter for the CSV-file is the ',' sign. The first line is interpreted as header and not as data. |
5 | 44 |
|
6 |
| -Name | Description |
7 |
| ----- | ----------- |
8 |
| -[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!* |
9 |
| -[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!* |
10 |
| -[SOME/IP feeder](./someip2val) | SOME/IP feeder for KUKSA.val Databroker |
11 |
| -[DDS Provider](https://github.com/eclipse-kuksa/kuksa-dds-provider) | DDS provider for KUKSA.val Databroker *- NOTE: Moved to new repo!* |
12 |
| -[Replay](./replay) | KUKSA.val Server replay script for previously recorded files, created by providing KUKSA.val Server with `--record` argument |
13 |
| -[CSV provider](./csv_provider) | Script to replay VSS signals to KUKSA.val Databroker as defined in a CSV-file |
| 45 | +Each line in the csv file consists of the following elements: |
| 46 | + |
| 47 | +| header | description | example | |
| 48 | +| -- | -----------| --| |
| 49 | +| field | indicates whether to update the current value (`current`) or the target value (`target`) for the signal. | current | |
| 50 | +| signal | the name of the signal to update | Vehicle.Speed |
| 51 | +| value | the new value | 48 | |
| 52 | +| delay | Indicates the time in seconds which the provider shall wait after processing this signal. This way one can emulate the change of signals over time. | 0 | |
| 53 | + |
| 54 | +## TLS |
| 55 | + |
| 56 | +If connecting to a KUKSA Databroker that require a secure connection you must specify which root certificate to |
| 57 | +use to identify the Server by the `--cacertificate` argument. If your (test) setup use the KUKSA example |
| 58 | +certificates you must give [CA.pem](https://github.com/eclipse/kuksa.val/blob/master/kuksa_certificates/CA.pem) |
| 59 | +as root CA. The server name must match the name in the certificate provided by KUKSA.val databroker. |
| 60 | +Due to a limitation in the gRPC client, if connecting by IP-address you may need to give a name listed in the certificate |
| 61 | +by the `--tls-server-name` argument. The example server certificate lists the names `Server` and `localhost`, |
| 62 | +so one of those names needs to be specified if connecting to `127.0.0.1`. An example is shown below: |
| 63 | + |
| 64 | +``` |
| 65 | +python provider.py --cacertificate /home/user/kuksa.val/kuksa_certificates/CA.pem --tls-server-name Server |
| 66 | +``` |
| 67 | + |
| 68 | +## Limitations |
| 69 | + |
| 70 | +* CSV Provider does not support authentication, i.e. it is impossible to communicate with a Databroker that require authentication! |
| 71 | + |
| 72 | +## Recorder |
| 73 | + |
| 74 | +One way to generate a CSV-file for the CSV-provider is to record it from an KUKSA Databroker. This way one can reproduce an interaction of different providers with the KUKSA Databroker. The script in `csv_provider/recorder.py` allows this recording. |
| 75 | +An example call, only recording the vehicle speed and width would be: |
| 76 | + |
| 77 | +``` |
| 78 | +pip install -r requirements.txt |
| 79 | +python3 recorder.py -s Vehicle.Speed Vehicle.Width |
| 80 | +``` |
| 81 | + |
| 82 | +The recorder supports the following parameters: |
| 83 | + |
| 84 | +| short argument | long argument | description | default value | |
| 85 | +|---- | ---- | ----- | ----| |
| 86 | +|-f| --file | This indicates the filename to which to write the VSS-signals. | signalsOut.csv | |
| 87 | +|-s| --signals | A list of signals to record. | There is no default value, but the argument is required.| | |
| 88 | +| -a | --address | This indicates the address of KUKSA Databroker to connect to. | 127.0.0.1 | |
| 89 | +| -p | --port | This indicates the port of the KUKSA Databroker to connect to. | 55555 | |
| 90 | +| -l | --log | This sets the logging level. Possible values are: DEBUG, INFO, WARNING, ERROR, CRITICAL | INFO |
14 | 91 |
|
15 | 92 | ## Pre-commit set up
|
| 93 | + |
16 | 94 | This repository is set up to use [pre-commit](https://pre-commit.com/) hooks.
|
17 | 95 | Use `pip install pre-commit` to install pre-commit.
|
18 | 96 | After you clone the project, run `pre-commit install` to install pre-commit into your git hooks.
|
|
0 commit comments