Merge branch 'develop' into patch-1

This commit is contained in:
Bastian Schroll 2025-06-11 10:20:17 +02:00 committed by GitHub
commit a6a1059931
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 41 additions and 17 deletions

View file

@ -1,6 +1,8 @@
name: pytest name: pytest
on: [push, pull_request] on:
push:
pull_request:
jobs: jobs:
build: build:
@ -8,11 +10,11 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10'] python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v3
- name: Set up Python ${{matrix.python-version}} at ${{matrix.os}} - name: Set up Python ${{matrix.python-version}} at ${{matrix.os}}
uses: actions/setup-python@v3 uses: actions/setup-python@v3
@ -23,14 +25,14 @@ jobs:
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
mkdir log/ mkdir -p log/
- name: Test with pytest - name: Test with pytest
run: | run: |
pytest -c 'test/pytest.ini' pytest -c 'test/pytest.ini'
- name: Save artifacts - name: Save artifacts
uses: actions/upload-artifact@master uses: actions/upload-artifact@v4
with: with:
name: test.log name: test-${{ matrix.python-version }}.log
path: log/test.log path: log/test.log

View file

@ -30,7 +30,8 @@ class RouterManager:
r"""!Class to manage all routers""" r"""!Class to manage all routers"""
def __init__(self): def __init__(self):
r"""!Create new router""" """!Create new router"""
self.config = None
self._routerDict = {} self._routerDict = {}
self._startTime = int(time.time()) self._startTime = int(time.time())
@ -40,6 +41,7 @@ class RouterManager:
@param config: instance of ConfigYaml class @param config: instance of ConfigYaml class
@return True or False""" @return True or False"""
self.config = config
self._routerDict = {} # all routers and instances of modules/plugins would be destroyed self._routerDict = {} # all routers and instances of modules/plugins would be destroyed
routerDict_tmp = {} routerDict_tmp = {}
logging.debug("build routers") logging.debug("build routers")
@ -116,7 +118,8 @@ class RouterManager:
else: else:
logging.warning("unknown router: %s", routerName) logging.warning("unknown router: %s", routerName)
self._saveStats() # write stats to stats file if self.config.get("server", "logging", default=False):
self._saveStats() # write stats to stats file
def cleanup(self): def cleanup(self):
r"""!Run cleanup routines for all loaded route points""" r"""!Run cleanup routines for all loaded route points"""

View file

@ -33,7 +33,7 @@ class=handlers.TimedRotatingFileHandler
interval=midnight interval=midnight
backupCount=7 backupCount=7
formatter=complex formatter=complex
level=DEBUG level=ERROR
args=('log/client.log',) args=('log/client.log',)
[handler_screen] [handler_screen]

View file

@ -33,7 +33,7 @@ class=handlers.TimedRotatingFileHandler
interval=midnight interval=midnight
backupCount=7 backupCount=7
formatter=complex formatter=complex
level=DEBUG level=ERROR
args=('log/server.log',) args=('log/server.log',)
[handler_screen] [handler_screen]

View file

@ -11,6 +11,7 @@ server:
port: 8080 port: 8080
name: BW3 Server # name of the BW3 Server instance name: BW3 Server # name of the BW3 Server instance
useBroadcast: no # serve server ip on broadcast request useBroadcast: no # serve server ip on broadcast request
logging: False # enable log file
alarmRouter: alarmRouter:
- Router 1 - Router 1

View file

@ -157,15 +157,16 @@ decoder:
``` ```
--- ---
## Server <h2 id="server-configuration">Server</h2>
Nachfolgend alle Paramater der Server Konfiguration Nachfolgend alle Parameter der Server Konfiguration
### `server:` ### `server:`
|Feld|Beschreibung|Default| |Feld|Beschreibung|Default|
|----|------------|-------| |----|------------|-------|
|port|Port auf dem der Server lauscht|8080 |port|Port auf dem der Server lauscht| 8080
|name|Name zur Identifizierung der Server Instanz|| |name|Name zur Identifizierung der Server Instanz||
|useBroadcast|Verbindungsdaten per Broadcast Server bereitstellen|no| |useBroadcast|Verbindungsdaten per Broadcast Server bereitstellen|no|
|logging|Aktivieren / Deaktivieren des Schreibens von Statistik-Dateien|False|
--- ---
### `alarmRouter:` ### `alarmRouter:`
@ -215,3 +216,16 @@ router:
## Module/Plugins ## Module/Plugins
Die möglichen Einstellungen der einzelnen Module und Plugins sind im jeweiligen Kapitel aufgelistet. Die möglichen Einstellungen der einzelnen Module und Plugins sind im jeweiligen Kapitel aufgelistet.
---
## Logging
Um den Datenträger, auf dem Boswatch läuft, zu schützen ist das Logging in
Dateien standartmäßig auf Fehlermeldungen begrenzt.
In den Dateien `logger_client.ini` bzw `logger_server.ini` kann dies
entsprechend im Bereich `handler_file` unter `level=` angepasst werden.
Das Schreiben einer Statistik-Datei, welche die Durchläufe aller Module
und Plugins dokumentiert, kann in der Server-Konfiguration über den Parameter
`logging` aktiviert werden.
(siehe [Server-Konfiguration](#server-configuration))

View file

@ -51,6 +51,10 @@ Vereinfacht kann man sagen, dass einzelnen Router ODER-verknüpft und die jeweil
regex: "fms" # check if mode is fms regex: "fms" # check if mode is fms
- field: status - field: status
regex: "3" # check if status is 3 regex: "3" # check if status is 3
- name: "Allowed RICs"
checks:
- field: ric
regex: "(0000001|0000002|0000003)" # check if RIC is in the list
``` ```
--- ---

View file

@ -113,7 +113,7 @@ tput cup 13 15
echo "[ 2/9] [##-------]" echo "[ 2/9] [##-------]"
tput cup 15 5 tput cup 15 5
echo "-> download GIT and other stuff.........." echo "-> download GIT and other stuff.........."
apt-get -y install git cmake build-essential libusb-1.0 qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qt5-default libpulse-dev libx11-dev sox >> ${boswatch_install_path}/setup_log.txt 2>&1 apt-get -y install git cmake build-essential libusb-1.0 qmake6 qt6-base-dev libpulse-dev libx11-dev sox >> ${boswatch_install_path}/setup_log.txt 2>&1
exitcodefunction $? download stuff exitcodefunction $? download stuff
tput cup 13 15 tput cup 13 15
@ -166,7 +166,7 @@ tput cup 15 5
echo "-> compile multimon-ng................." echo "-> compile multimon-ng................."
mkdir -p build mkdir -p build
cd build cd build
qmake -qt=qt5 ../multimon-ng.pro >> ${boswatch_install_path}/setup_log.txt 2>&1 qmake6 ../multimon-ng.pro >> ${boswatch_install_path}/setup_log.txt 2>&1
exitcodefunction $? qmake multimonNG exitcodefunction $? qmake multimonNG
make >> ${boswatch_install_path}/setup_log.txt 2>&1 make >> ${boswatch_install_path}/setup_log.txt 2>&1

View file

@ -8,7 +8,7 @@ mkdocs
# for develope only # for develope only
pytest pytest
pytest-cov pytest-cov
flake8==4.0.1 flake8==6.1.0
pytest-flake8 pytest-flake8
pytest-flakes pytest-flakes
pytest-randomly pytest-randomly