Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Authorization update
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbosch committed Apr 6, 2023
1 parent e620e9b commit 2c64f90
Show file tree
Hide file tree
Showing 15 changed files with 575 additions and 277 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max_line_length = 120
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit

on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# required to grab the history of the PR
fetch-depth: 0
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude_types: ["dbc"]
- id: end-of-file-fixer
exclude_types: ["dbc"]
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
hooks:
- id: flake8
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ Name | Description
[DBC feeder](./dbc2val) | DBC feeder for `kuksa.val` server/databroker
[SOME/IP feeder](./someip2val) | SOME/IP feeder for `kuksa.val` databroker
[Replay](./replay) | Replay script for previously recorded files when providing `kuksa.val` with --record argument


## Pre-commit set up
This repository is set up to use pre-commit hooks.
After you clone the project, run `pre-commit install` to install pre-commit into your git hooks.
Pre-commit will now run on every commit.
Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do.
2 changes: 1 addition & 1 deletion dbc2val/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This file lists important changes to dbc2val
## Refactoring and changed configuration format (2023-02)

Feeder refactored and new mapping format based on VSS introduced, see [documentation](mapping.md).
Old mapping format no longer supported.
Old mapping format no longer supported.
24 changes: 12 additions & 12 deletions dbc2val/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ A smaller excerpt from the above sample, with less signals.
| use-socketcan | False | - | - | `--use-socketcan` | Use SocketCAN (overriding any use of --dumpfile) |
| mapping | mapping/vss_3.1.1/vss_dbc.json | [general].mapping | MAPPING_FILE | `--mapping` | Mapping file used to map CAN signals to databroker datapoints. Take a look on usage of the mapping file |
| server-type | kuksa_databroker | [general].server_type | SERVER_TYPE | `--server-type` | Which type of server the feeder should connect to (kuksa_val_server or kuksa_databroker |
| DAPR_GRPC_PORT | - | - | DAPR_GRPC_PORT | - | Override broker address & connect to DAPR sidecar @ 127.0.0.1:DAPR_GRPC_PORT |
| VEHICLEDATABROKER_DAPR_APP_ID | - | - | VEHICLEDATABROKER_DAPR_APP_ID | - | Add dapr-app-id metadata |
| ip | 127.0.0.1 (Databroker), localhost (Server) | [general].ip | KUKSA_ADDRESS | -| IP address for Server/Databroker|
| port | 55555 (Databroker), 8090 (Server) | [general].port | KUKSA_PORT | -| Port for Server/Databroker|
| tls | False (Databroker), True (Server) | [general].tls | - | `--tls [True or False]` | Shall tls be used for Server/Databroker connection|
| token | Undefined (Databroker), Kuksa-client default (Server) | [general].token | - | - | Token path to use. Only needed if Databroker/Server requires authentication|
| VEHICLEDATABROKER_DAPR_APP_ID | - | - | VEHICLEDATABROKER_DAPR_APP_ID | - | Add dapr-app-id metadata. Only relevant for KUKSA.val Databroker

*Note that the [default config file](config/dbc_feeder.ini) include default Databroker settings and must be modified if you intend to use it for KUKSA.val Server*

Configuration options have the following priority (highest at top).

Expand Down Expand Up @@ -233,26 +238,22 @@ To set the log level to DEBUG
$ LOG_LEVEL=debug ./dbcfeeder.py
```

Set log level to INFO, but for dbcfeeder.broker set it to DEBUG
Set log level to INFO, but for dbcfeederlib.databrokerclientwrapper set it to DEBUG

```console
$ LOG_LEVEL=info,dbcfeeder.broker_client=debug ./dbcfeeder.py
$ LOG_LEVEL=info,dbcfeederlib.databrokerclientwrapper=debug ./dbcfeeder.py
```

or, since INFO is the default log level, this is equivalent to:

```console
$ LOG_LEVEL=dbcfeeder.broker_client=debug ./dbcfeeder.py
$ LOG_LEVEL=dbcfeederlib.databrokerclientwrapper=debug ./dbcfeeder.py
```

Available loggers:
- dbcfeeder
- dbcfeeder.broker_client
- databroker
- dbcreader
- dbcmapper
- can
- j1939
- dbcfeederlib.* (one for every file in the dbcfeeder directory)
- kuksa-client (to control loggings provided by [kuksa-client](https://github.com/eclipse/kuksa.val/tree/master/kuksa-client))

## ELM/OBDLink support

Expand Down Expand Up @@ -291,4 +292,3 @@ $ pip install .
```

The detailed documentation to this feature can be found [here](https://dias-kuksa-doc.readthedocs.io/en/latest/contents/j1939.html).

38 changes: 24 additions & 14 deletions dbc2val/config/dbc_feeder.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,32 @@ server_type = kuksa_databroker
# VSS mapping file
mapping = mapping/vss_3.1.1/vss_dbc.json

[kuksa_val_server]
# kuksa_val_server IP address or host name
# Same configs used for KUKSA.val Server and Databroker
# Note that default values below corresponds to Databroker
# Default values for KUKSA.val Server is commented below

# IP address for server (KUKSA.val Server or Databroker)
ip = 127.0.0.1
# ip = localhost

# Port for server (KUKSA.val Server or Databroker)
port = 55555
# port = 8090
# protocol = ws
# insecure = False
# JWT security token file
# token=../../kuksa_certificates/jwt/super-admin.json.token

[kuksa_databroker]
# kuksa_databroker IP address or host name
# ip = 127.0.0.1
# port = 55555
# protocol = grpc
# kuksa_databroker does not yet support security features
# insecure = True

# Shall TLS be used (default False for Databroker, True for KUKSA.val Server)
tls = False
# tls = True

# Token file for authorization.
# Default behavior differ between servers
# For KUKSA.val Databroker the KUKSA.val default token not included in packages and containers
# If you run your Databroker so it require authentication you must specify token
# The example below works if you have cloned kuksa.val in parallel to kuksa.val.feeders
#token=../../kuksa.val/jwt/provide-all.token
# For KUKSA.val Server the default behavior is to use the token provided as part of kuksa-client
# So you only need to specify a different token if you want to use a different token
# Possibly like below
# token=../../kuksa.val/kuksa_certificates/jwt/super-admin.json.token

[can]
# CAN port, use elmcan to start the elmcan bridge
Expand Down
2 changes: 0 additions & 2 deletions dbc2val/createvcan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ fi
virtualCanConfigure

echo "createvcan: Done."


Loading

0 comments on commit 2c64f90

Please sign in to comment.