diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-10-11 16:00:28 -0400 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2022-10-31 11:22:38 +0000 |
commit | 08c147c6ae6532088a9753ae0272653cfbd8879b (patch) | |
tree | be6062b00ac3799597fda6dd2ced61fcef3465e5 | |
parent | 9aa37897cdf3bcd7f4d5650c11bc2b679a6b9099 (diff) |
kuksa-val: Upgrade to latest
Changes:
- Upgrade kuksa-val and kuksa-viss-client to a commit that includes
the 0.2.5 release tag and some fixes past it. The patches for each
have been updated against the newer version, with backported ones
dropped.
- The affected recipes have been updated to include some new gRPC
tooling dependencies, and a recipe for a new jsonpath-ng dependency
has been added.
- Rework the kuksa-dbc-feeder recipe for the splitting out of the
example feeders from the main kuksa-val repository.
- Rework our local kuksa-dbc-feeder patches against the newer version,
as upstream has made several improvements. Also drop the duplicate
filtering feature patch, as it seems likely we will not need it
going forward.
- Update the kuksa-dbc-feeder configuration files to work with the new
version. Notable is a change in the engine speed signal naming in
VSS 3.0, which is the new default for VSS schema.
- The kuksa-val and kuksa-val-feeders trees have changed their
licensing from EPL-1.0 to Apache-2.0, update the recipes
accordingly.
Bug-AGL: SPEC-4587
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Ibc990767219f79af95929e86361e66beda2d0c9e
(cherry picked from commit 54ef381ec92148015cbd743a1b30771cca22f80b)
17 files changed, 491 insertions, 462 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini index 66980cb58..24d637954 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini @@ -1,10 +1,16 @@ +[general] +# use case: +# switch between databroker and kuksa +# default kuksa +usecase = kuksa +# VSS mapping file +mapping=/etc/kuksa-dbc-feeder/mapping.yml + [kuksa_val] # kuksa VSS server address server=wss://localhost:8090 # JWT security token file token=/etc/kuksa-dbc-feeder/dbc_feeder.json.token -# VSS mapping file -mapping=/etc/kuksa-dbc-feeder/mapping.yml [can] # CAN port diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch index 1e84eeb7e..4221df5c8 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch @@ -1,93 +1,202 @@ -From 603b5a584bd2b348befc9bab8f1ea0a7974f9d77 Mon Sep 17 00:00:00 2001 +From 22062d99a89922e02b626e4701feaac8947af5fb Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Wed, 11 May 2022 15:31:25 -0400 -Subject: [PATCH] dbc2val: add installation mechanism +Date: Fri, 7 Oct 2022 15:54:48 -0400 +Subject: [PATCH 1/2] dbc2val: add installation mechanism Add setup.py and setup.cfg to allow installing the dbc2val module and dbcfeeder.py in a way suitable for packaging. Some of the imports in the scripts have been tweaked to enable running against an installed copy of dbc2val. -Signed-off-by: Scott Murray <scott.murray@konsulko.com> +Upstream-Status: pending +Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - kuksa_feeders/dbc2val/__init__.py | 0 - kuksa_feeders/dbc2val/dbc2vssmapper.py | 12 ++++----- - kuksa_feeders/dbc2val/dbcfeeder.py | 6 ++--- - kuksa_feeders/setup.cfg | 31 ++++++++++++++++++++++ - kuksa_feeders/setup.py | 36 ++++++++++++++++++++++++++ - 5 files changed, 75 insertions(+), 10 deletions(-) - create mode 100644 kuksa_feeders/dbc2val/__init__.py - create mode 100644 kuksa_feeders/setup.cfg - create mode 100644 kuksa_feeders/setup.py + dbc2val/__init__.py | 0 + dbc2val/databroker.py | 4 +-- + dbc2val/dbc2vssmapper.py | 12 +++---- + dbc2val/dbcfeeder.py | 8 ++--- + dbc2val/gen_proto/__init__.py | 0 + dbc2val/gen_proto/sdv/__init__.py | 0 + dbc2val/gen_proto/sdv/databroker/__init__.py | 0 + .../gen_proto/sdv/databroker/v1/__init__.py | 0 + .../gen_proto/sdv/databroker/v1/broker_pb2.py | 2 +- + .../sdv/databroker/v1/broker_pb2_grpc.py | 2 +- + .../sdv/databroker/v1/collector_pb2.py | 2 +- + .../sdv/databroker/v1/collector_pb2_grpc.py | 2 +- + setup.cfg | 31 ++++++++++++++++ + setup.py | 36 +++++++++++++++++++ + 14 files changed, 82 insertions(+), 17 deletions(-) + create mode 100644 dbc2val/__init__.py + create mode 100644 dbc2val/gen_proto/__init__.py + create mode 100644 dbc2val/gen_proto/sdv/__init__.py + create mode 100644 dbc2val/gen_proto/sdv/databroker/__init__.py + create mode 100644 dbc2val/gen_proto/sdv/databroker/v1/__init__.py + create mode 100644 setup.cfg + create mode 100644 setup.py -diff --git a/kuksa_feeders/dbc2val/__init__.py b/kuksa_feeders/dbc2val/__init__.py +diff --git a/dbc2val/__init__.py b/dbc2val/__init__.py new file mode 100644 index 0000000..e69de29 -diff --git a/kuksa_feeders/dbc2val/dbc2vssmapper.py b/kuksa_feeders/dbc2val/dbc2vssmapper.py -index a43d1bd..1718154 100644 ---- a/kuksa_feeders/dbc2val/dbc2vssmapper.py -+++ b/kuksa_feeders/dbc2val/dbc2vssmapper.py -@@ -11,8 +11,8 @@ - ######################################################################## +diff --git a/dbc2val/databroker.py b/dbc2val/databroker.py +index c1a941a..ba52980 100644 +--- a/dbc2val/databroker.py ++++ b/dbc2val/databroker.py +@@ -16,13 +16,13 @@ + import logging + + import grpc +-from gen_proto.sdv.databroker.v1 import ( ++from dbc2val.gen_proto.sdv.databroker.v1 import ( + broker_pb2, + broker_pb2_grpc, + collector_pb2, + collector_pb2_grpc, + ) +-from gen_proto.sdv.databroker.v1 import types_pb2 as types # for export ++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as types # for export + + log = logging.getLogger(__name__) + +diff --git a/dbc2val/dbc2vssmapper.py b/dbc2val/dbc2vssmapper.py +index 05b78f1..d76c068 100644 +--- a/dbc2val/dbc2vssmapper.py ++++ b/dbc2val/dbc2vssmapper.py +@@ -20,8 +20,8 @@ + import yaml -import transforms.mapping -import transforms.math +from dbc2val.transforms import mapping +from dbc2val.transforms import math + import logging - - class mapper: -@@ -22,9 +22,9 @@ class mapper: + log = logging.getLogger(__name__) +@@ -33,13 +33,13 @@ class mapper: self.mapping = yaml.full_load(file) - self.transforms={} -- self.transforms['fullmapping']=transforms.mapping.mapping(discard_non_matching_items=True) -- self.transforms['partialmapping']=transforms.mapping.mapping(discard_non_matching_items=False) -- self.transforms['math']=transforms.math.math() -+ self.transforms['fullmapping']=mapping.mapping(discard_non_matching_items=True) -+ self.transforms['partialmapping']=mapping.mapping(discard_non_matching_items=False) -+ self.transforms['math']=math.math() - - + self.transforms = {} +- self.transforms["fullmapping"] = transforms.mapping.mapping( ++ self.transforms["fullmapping"] = mapping.mapping( + discard_non_matching_items=True + ) +- self.transforms["partialmapping"] = transforms.mapping.mapping( ++ self.transforms["partialmapping"] = mapping.mapping( + discard_non_matching_items=False + ) +- self.transforms["math"] = transforms.math.math() ++ self.transforms["math"] = math.math() -@@ -62,4 +62,4 @@ class mapper: + for key in self.mapping.keys(): + self.mapping[key]["lastupdate"] = 0.0 +@@ -93,4 +93,4 @@ class mapper: def __getitem__(self, item): return self.mapping[item] - \ No newline at end of file + -diff --git a/kuksa_feeders/dbc2val/dbcfeeder.py b/kuksa_feeders/dbc2val/dbcfeeder.py -index 71939c6..56c316a 100755 ---- a/kuksa_feeders/dbc2val/dbcfeeder.py -+++ b/kuksa_feeders/dbc2val/dbcfeeder.py -@@ -16,10 +16,7 @@ import configparser - import queue - import json +diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py +index 5267369..7daaa2b 100755 +--- a/dbc2val/dbcfeeder.py ++++ b/dbc2val/dbcfeeder.py +@@ -28,16 +28,13 @@ import sys + import time + from signal import SIGINT, SIGTERM, signal +-import canplayer -import dbc2vssmapper -import dbcreader + import grpc -import j1939reader --import elm2canbridge -+from dbc2val import dbc2vssmapper, dbcreader, j1939reader, elm2canbridge - - scriptDir= os.path.dirname(os.path.realpath(__file__)) - sys.path.append(os.path.join(scriptDir, "../../")) -@@ -27,6 +24,7 @@ from kuksa_viss_client import KuksaClientThread - - print("kuksa.val DBC example feeder") - config_candidates=['/config/dbc_feeder.ini', '/etc/dbc_feeder.ini', os.path.join(scriptDir, 'config/dbc_feeder.ini')] -+configfile = None - for candidate in config_candidates: - if os.path.isfile(candidate): - configfile=candidate -diff --git a/kuksa_feeders/setup.cfg b/kuksa_feeders/setup.cfg ++from dbc2val import dbc2vssmapper, dbcreader, j1939reader, canplayer + + # kuksa related + from kuksa_viss_client import KuksaClientThread + # databroker related +-import databroker ++from dbc2val import databroker + + # global variable for usecase, default databroker + USE_CASE = "" +@@ -289,6 +286,7 @@ def parse_config(filename): + "/etc/dbc_feeder.ini", + "config/dbc_feeder.ini", + ] ++ configfile = None + for candidate in config_candidates: + if os.path.isfile(candidate): + configfile = candidate +diff --git a/dbc2val/gen_proto/__init__.py b/dbc2val/gen_proto/__init__.py +new file mode 100644 +index 0000000..e69de29 +diff --git a/dbc2val/gen_proto/sdv/__init__.py b/dbc2val/gen_proto/sdv/__init__.py +new file mode 100644 +index 0000000..e69de29 +diff --git a/dbc2val/gen_proto/sdv/databroker/__init__.py b/dbc2val/gen_proto/sdv/databroker/__init__.py +new file mode 100644 +index 0000000..e69de29 +diff --git a/dbc2val/gen_proto/sdv/databroker/v1/__init__.py b/dbc2val/gen_proto/sdv/databroker/v1/__init__.py new file mode 100644 -index 0000000..4b69ccf +index 0000000..e69de29 +diff --git a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py +index 98dc94a..6deacfb 100644 +--- a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py ++++ b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py +@@ -12,7 +12,7 @@ from google.protobuf import symbol_database as _symbol_database + _sym_db = _symbol_database.Default() + + +-from gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2 ++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2 + + + DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1esdv/databroker/v1/broker.proto\x12\x11sdv.databroker.v1\x1a\x1dsdv/databroker/v1/types.proto\"*\n\x14GetDatapointsRequest\x12\x12\n\ndatapoints\x18\x01 \x03(\t\"\xb0\x01\n\x12GetDatapointsReply\x12I\n\ndatapoints\x18\x01 \x03(\x0b\x32\x35.sdv.databroker.v1.GetDatapointsReply.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"!\n\x10SubscribeRequest\x12\r\n\x05query\x18\x02 \x01(\t\"\x9c\x01\n\x0eSubscribeReply\x12=\n\x06\x66ields\x18\x01 \x03(\x0b\x32-.sdv.databroker.v1.SubscribeReply.FieldsEntry\x1aK\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"#\n\x12GetMetadataRequest\x12\r\n\x05names\x18\x01 \x03(\t\"=\n\x10GetMetadataReply\x12)\n\x04list\x18\x01 \x03(\x0b\x32\x1b.sdv.databroker.v1.Metadata2\x9b\x02\n\x06\x42roker\x12_\n\rGetDatapoints\x12\'.sdv.databroker.v1.GetDatapointsRequest\x1a%.sdv.databroker.v1.GetDatapointsReply\x12U\n\tSubscribe\x12#.sdv.databroker.v1.SubscribeRequest\x1a!.sdv.databroker.v1.SubscribeReply0\x01\x12Y\n\x0bGetMetadata\x12%.sdv.databroker.v1.GetMetadataRequest\x1a#.sdv.databroker.v1.GetMetadataReplyb\x06proto3') +diff --git a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py +index 5c87db1..bc6be8b 100644 +--- a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py ++++ b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py +@@ -2,7 +2,7 @@ + """Client and server classes corresponding to protobuf-defined services.""" + import grpc + +-from gen_proto.sdv.databroker.v1 import broker_pb2 as sdv_dot_databroker_dot_v1_dot_broker__pb2 ++from dbc2val.gen_proto.sdv.databroker.v1 import broker_pb2 as sdv_dot_databroker_dot_v1_dot_broker__pb2 + + + class BrokerStub(object): +diff --git a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py +index 25d69dd..ea15409 100644 +--- a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py ++++ b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py +@@ -12,7 +12,7 @@ from google.protobuf import symbol_database as _symbol_database + _sym_db = _symbol_database.Default() + + +-from gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2 ++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2 + + + DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!sdv/databroker/v1/collector.proto\x12\x11sdv.databroker.v1\x1a\x1dsdv/databroker/v1/types.proto\"\xba\x01\n\x17UpdateDatapointsRequest\x12N\n\ndatapoints\x18\x01 \x03(\x0b\x32:.sdv.databroker.v1.UpdateDatapointsRequest.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"\xaf\x01\n\x15UpdateDatapointsReply\x12\x44\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x34.sdv.databroker.v1.UpdateDatapointsReply.ErrorsEntry\x1aP\n\x0b\x45rrorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x30\n\x05value\x18\x02 \x01(\x0e\x32!.sdv.databroker.v1.DatapointError:\x02\x38\x01\"\xba\x01\n\x17StreamDatapointsRequest\x12N\n\ndatapoints\x18\x01 \x03(\x0b\x32:.sdv.databroker.v1.StreamDatapointsRequest.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"\xaf\x01\n\x15StreamDatapointsReply\x12\x44\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x34.sdv.databroker.v1.StreamDatapointsReply.ErrorsEntry\x1aP\n\x0b\x45rrorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x30\n\x05value\x18\x02 \x01(\x0e\x32!.sdv.databroker.v1.DatapointError:\x02\x38\x01\"R\n\x19RegisterDatapointsRequest\x12\x35\n\x04list\x18\x01 \x03(\x0b\x32\'.sdv.databroker.v1.RegistrationMetadata\"\x9d\x01\n\x14RegistrationMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\tdata_type\x18\x02 \x01(\x0e\x32\x1b.sdv.databroker.v1.DataType\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x32\n\x0b\x63hange_type\x18\x04 \x01(\x0e\x32\x1d.sdv.databroker.v1.ChangeType\"\x93\x01\n\x17RegisterDatapointsReply\x12H\n\x07results\x18\x01 \x03(\x0b\x32\x37.sdv.databroker.v1.RegisterDatapointsReply.ResultsEntry\x1a.\n\x0cResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x32\xd3\x02\n\tCollector\x12n\n\x12RegisterDatapoints\x12,.sdv.databroker.v1.RegisterDatapointsRequest\x1a*.sdv.databroker.v1.RegisterDatapointsReply\x12h\n\x10UpdateDatapoints\x12*.sdv.databroker.v1.UpdateDatapointsRequest\x1a(.sdv.databroker.v1.UpdateDatapointsReply\x12l\n\x10StreamDatapoints\x12*.sdv.databroker.v1.StreamDatapointsRequest\x1a(.sdv.databroker.v1.StreamDatapointsReply(\x01\x30\x01\x62\x06proto3') +diff --git a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py +index 419bfde..2dee751 100644 +--- a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py ++++ b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py +@@ -2,7 +2,7 @@ + """Client and server classes corresponding to protobuf-defined services.""" + import grpc + +-from gen_proto.sdv.databroker.v1 import collector_pb2 as sdv_dot_databroker_dot_v1_dot_collector__pb2 ++from dbc2val.gen_proto.sdv.databroker.v1 import collector_pb2 as sdv_dot_databroker_dot_v1_dot_collector__pb2 + + + class CollectorStub(object): +diff --git a/setup.cfg b/setup.cfg +new file mode 100644 +index 0000000..70aab60 --- /dev/null -+++ b/kuksa_feeders/setup.cfg ++++ b/setup.cfg @@ -0,0 +1,31 @@ +[metadata] +name = dbc2val @@ -105,11 +214,11 @@ index 0000000..4b69ccf + Development Status :: 3 - Alpha + Environment :: Console + Programming Language :: Python :: 3 -+ License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0) ++ License :: OSI Approved :: Apache Software License + Operating System :: OS Independent + Topic :: Software Development + -+license_file = ../LICENSE ++license_file = LICENSE.txt + +[options] +python_requires = >=3.6 @@ -120,11 +229,11 @@ index 0000000..4b69ccf +packages=find: +include_package_data = True +scripts=dbc2val/dbcfeeder.py -diff --git a/kuksa_feeders/setup.py b/kuksa_feeders/setup.py +diff --git a/setup.py b/setup.py new file mode 100644 -index 0000000..ad08d17 +index 0000000..55951cc --- /dev/null -+++ b/kuksa_feeders/setup.py ++++ b/setup.py @@ -0,0 +1,36 @@ +# To avoid shipping dbcfeeder.py in the module itself, use the +# technique outlined at: @@ -154,7 +263,7 @@ index 0000000..ad08d17 + "template": "{tag}", + "dev_template": "{tag}-{ccount}", + "dirty_template": "{tag}-{ccount}-dirty", -+ "starting_version": "0.1.11", ++ "starting_version": "0.1.0", + "version_callback": None, + "version_file": None, + "count_commits_from_version_file": False @@ -162,3 +271,6 @@ index 0000000..ad08d17 + setup_requires=['setuptools-git-versioning'], + cmdclass={'build_py': build_py}, +) +-- +2.37.3 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch index 12e366aa8..be88fa0ee 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch @@ -1,120 +1,129 @@ -From fe10a3645e77cd8122d3d312d317bedcb88bc683 Mon Sep 17 00:00:00 2001 +From d0730c0d643738ac683d1b5c19b117893e3b2049 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Thu, 12 May 2022 17:39:56 +0200 -Subject: [PATCH] dbc2val: usability improvements +Date: Tue, 11 Oct 2022 15:28:07 -0400 +Subject: [PATCH 2/2] dbc2val: usability improvements Changes: - Tweaked default configuration file search path to better match Linux FHS and kuksa-val-server. First look for a config.ini in /etc/kuksa-dbc-feeder, then /etc/dbc_feeder.ini. -- Added a command-line option to specify configuration file, this - should allow running two instances against different interfaces. -- Added verbosity command-line option and made several messages - verbose mode only to avoid log spamming. -- Added '-u' option to python invocation to disable output buffering. - The intent is to make logging immediate, otherwise errors may not - get logged for some time (or at all). - Add catching of exceptions around CAN device opening so that the script can exit cleanly with an error message if the device is not available. +- Fixed shutdown behavior with some tweaks to actually stop the + reader and KUKSA.val client library threads. This makes the + script actually exit on SIGTERM as opposed to hanging. Upstream-Status: pending + Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - kuksa_feeders/dbc2val/dbcfeeder.py | 40 ++++++++++++++++++++++-------- - 1 file changed, 29 insertions(+), 11 deletions(-) + dbc2val/dbcfeeder.py | 21 +++++++++++++++------ + dbc2val/dbcreader.py | 12 ++++++++---- + 2 files changed, 23 insertions(+), 10 deletions(-) -diff --git a/kuksa_feeders/dbc2val/dbcfeeder.py b/kuksa_feeders/dbc2val/dbcfeeder.py -index 56c316a..d2d70b9 100755 ---- a/kuksa_feeders/dbc2val/dbcfeeder.py -+++ b/kuksa_feeders/dbc2val/dbcfeeder.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env -S python -u - - ######################################################################## - # Copyright (c) 2020 Robert Bosch GmbH -@@ -15,15 +15,21 @@ import os, sys, signal - import configparser - import queue - import json -+import argparse - - from dbc2val import dbc2vssmapper, dbcreader, j1939reader, elm2canbridge -- --scriptDir= os.path.dirname(os.path.realpath(__file__)) --sys.path.append(os.path.join(scriptDir, "../../")) - from kuksa_viss_client import KuksaClientThread - --print("kuksa.val DBC example feeder") --config_candidates=['/config/dbc_feeder.ini', '/etc/dbc_feeder.ini', os.path.join(scriptDir, 'config/dbc_feeder.ini')] -+parser = argparse.ArgumentParser("kuksa.val DBC example feeder") -+parser.add_argument("-c", "--config", dest="userconfig") -+parser.add_argument("-v", "--verbose", action="store_true") -+args = parser.parse_args() -+ -+if args.verbose: -+ print("kuksa.val DBC example feeder") -+config_candidates=['/etc/kuksa-dbc-feeder/config.ini', '/etc/dbc_feeder.ini'] -+if args.userconfig is not None: -+ config_candidates.insert(0, args.userconfig) - configfile = None - for candidate in config_candidates: - if os.path.isfile(candidate): -@@ -54,10 +60,12 @@ cancfg = config['can'] - canport = cancfg['port'] +diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py +index 7daaa2b..33c2212 100755 +--- a/dbc2val/dbcfeeder.py ++++ b/dbc2val/dbcfeeder.py +@@ -93,6 +93,7 @@ class Feeder: + self._connected = False + self._registered = False + self._can_queue = queue.Queue() ++ self.kuksa = None - if config["can"].getboolean("j1939", False): -- print("Use j1939 reader") -+ if args.verbose: -+ print("Use j1939 reader") - reader = j1939reader.J1939Reader(cancfg,canQueue,mapping) - else: -- print("Use dbc reader") -+ if args.verbose: -+ print("Use dbc reader") - reader = dbcreader.DBCReader(cancfg, canQueue,mapping) + def start( + self, +@@ -134,7 +135,11 @@ class Feeder: + else: + # use socketCAN + log.info("Using socket CAN device '%s'", canport) +- self._reader.start_listening(bustype="socketcan", channel=canport) ++ try: ++ self._reader.start_listening(bustype="socketcan", channel=canport) ++ except: ++ log.error("Could not open {}, exiting".format(canport)) ++ sys.exit(-1) + + # databroker related + if USE_CASE=="databroker": +@@ -151,6 +156,8 @@ class Feeder: + log.info("Shutting down...") + self._shutdown = True + # Tell others to stop ++ if USE_CASE=="kuksa" and self.kuksa is not None: ++ self.kuksa.stop() + if self._reader is not None: + self._reader.stop() + if self._player is not None: +@@ -204,9 +211,10 @@ class Feeder: + # kuksa related + if USE_CASE=="kuksa": + global kuksaconfig +- kuksa = KuksaClientThread(kuksaconfig) +- kuksa.start() +- kuksa.authorize() ++ self.kuksa = KuksaClientThread(kuksaconfig) ++ self.kuksa.start() ++ if "token" in kuksaconfig: ++ self.kuksa.authorize(kuksaconfig["token"]) + + while self._shutdown is False: + # databroker related +@@ -255,7 +263,7 @@ class Feeder: + self._provider.update_datapoint(target, value) + # kuksa related + elif USE_CASE=="kuksa": +- resp=json.loads(kuksa.setValue(target, str(value))) ++ resp=json.loads(self.kuksa.setValue(target, str(value))) + if "error" in resp: + if "message" in resp["error"]: + log.error("Error setting {}: {}".format(target, resp["error"]["message"])) +@@ -282,8 +290,9 @@ def parse_config(filename): + configfile = filename + else: + config_candidates = [ +- "/config/dbc_feeder.ini", ++ "/etc/kuksa-dbc-feeder/config.ini", + "/etc/dbc_feeder.ini", ++ "/config/dbc_feeder.ini", + "config/dbc_feeder.ini", + ] + configfile = None +diff --git a/dbc2val/dbcreader.py b/dbc2val/dbcreader.py +index 2500832..b537a4d 100644 +--- a/dbc2val/dbcreader.py ++++ b/dbc2val/dbcreader.py +@@ -54,8 +54,8 @@ class DBCReader: + Bitrate in bit/s. + """ + self.bus = can.interface.Bus(*args, **kwargs) +- rxThread = threading.Thread(target=self.rxWorker) +- rxThread.start() ++ self.rxThread = threading.Thread(target=self.rxWorker) ++ self.rxThread.start() - if canport == 'elmcan': -@@ -65,10 +73,18 @@ if canport == 'elmcan': - print("section {} missing from configuration, exiting".format(canport)) - sys.exit(-1) + def get_whitelist(self): + log.info("Collecting signals, generating CAN ID whitelist") +@@ -83,7 +83,10 @@ class DBCReader: + def rxWorker(self): + log.info("Starting Rx thread") + while self.run: +- msg = self.bus.recv(timeout=1) ++ try: ++ msg = self.bus.recv(timeout=1) ++ except Exception: ++ break + if msg and msg.arbitration_id in self.canidwl: + try: + decode = self.db.decode_message(msg.arbitration_id, msg.data) +@@ -105,4 +108,5 @@ class DBCReader: -- print("Using elmcan. Trying to set up elm2can bridge") -+ if args.verbose: -+ print("Using elmcan. Trying to set up elm2can bridge") - elmbr=elm2canbridge.elm2canbridge(canport, config[canport], reader.canidwl) - --reader.start_listening() -+try: -+ reader.start_listening() -+except: -+ print("Could not open {}, exiting".format(canport)) -+ kuksa.stop() -+ reader.stop() -+ sys.exit(-1) -+ - running = True - - def terminationSignalreceived(signalNumber, frame): -@@ -77,6 +93,7 @@ def terminationSignalreceived(signalNumber, frame): - kuksa.stop() - reader.stop() - print("Received termination signal. Shutting down") -+ sys.exit(0) - - signal.signal(signal.SIGINT, terminationSignalreceived) - signal.signal(signal.SIGQUIT, terminationSignalreceived) -@@ -88,7 +105,8 @@ while running: - for target in mapping[signal]['targets']: - tv=mapping.transform(signal,target,value) - if tv is not None: #none indicates the transform decided to not set the value -- print("Update VSS path {} to {} based on signal {}".format(target, tv, signal)) -+ if args.verbose: -+ print("Update VSS path {} to {} based on signal {}".format(target, tv, signal)) - resp=json.loads(kuksa.setValue(target, str(tv))) - if "error" in resp: - if "message" in resp["error"]: + def stop(self): + self.run = False +- ++ self.bus.shutdown() ++ self.rxThread.join() -- -2.35.1 +2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch deleted file mode 100644 index 1709ac1e4..000000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a22d972bc497ab46d99c1d118bd40b9471fef3a7 Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 13 Jun 2022 12:54:54 -0400 -Subject: [PATCH] dbc2val: add duplicate filtering option - -To avoid generating a lot of duplicated signal events from the -CAN messages generated by LIN polling, add a per-target -"filter-duplicates" option that can be used for signals where -only changes should be pushed toi the VIS server. This is -required with the current performance of the DBC feeder to avoid -ending up with an increasing backlog of signal commands to the -server. This will be investigated with upstream. - -Upstream-Status: pending -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - kuksa_feeders/dbc2val/dbc2vssmapper.py | 27 +++++++++++++++++++------- - 1 file changed, 20 insertions(+), 7 deletions(-) - -diff --git a/kuksa_feeders/dbc2val/dbc2vssmapper.py b/kuksa_feeders/dbc2val/dbc2vssmapper.py -index 1718154..2feb572 100644 ---- a/kuksa_feeders/dbc2val/dbc2vssmapper.py -+++ b/kuksa_feeders/dbc2val/dbc2vssmapper.py -@@ -48,14 +48,27 @@ class mapper: - # Check whether there are transforms defined to map DBC signal "signal" to - # VSS path "target". Returns the (potentially) transformed values - def transform(self,signal, target, value): -- if "transform" not in self.mapping[signal]["targets"][target].keys(): #no transform defined, return as is -- return value -- for transform in self.mapping[signal]["targets"][target]["transform"]: -- if transform in self.transforms.keys(): #found a known transform and apply -- value=self.transforms[transform].transform(self.mapping[signal]["targets"][target]["transform"][transform],value) -+ result = value -+ if "transform" in self.mapping[signal]["targets"][target].keys(): -+ for transform in self.mapping[signal]["targets"][target]["transform"]: -+ if transform in self.transforms.keys(): #found a known transform and apply -+ result = self.transforms[transform].transform(self.mapping[signal]["targets"][target]["transform"][transform],value) -+ else: -+ print(f"Warning: Unknown transform {transform} for {signal}->{target}") -+ # else no transform defined, return as is -+ -+ if (("filter-duplicates" in self.mapping[signal]["targets"][target]) and -+ self.mapping[signal]["targets"][target]["filter-duplicates"] == "true"): -+ if "last" in self.mapping[signal]["targets"][target]: -+ if self.mapping[signal]["targets"][target]["last"] == result: -+ # ignore duplicate value -+ result = None -+ else: -+ self.mapping[signal]["targets"][target]["last"] = result - else: -- print(f"Warning: Unknown transform {transform} for {signal}->{target}") -- return value -+ self.mapping[signal]["targets"][target]["last"] = result -+ -+ return result - - def __contains__(self,key): - return key in self.mapping.keys() --- -2.35.1 - diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini index 25c9fd273..7da8381f0 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini @@ -1,10 +1,16 @@ +[general] +# use case: +# switch between databroker and kuksa +# default kuksa +usecase = kuksa +# VSS mapping file +mapping=/etc/kuksa-dbc-feeder/mapping.yml + [kuksa_val] # kuksa VSS server address server=wss://localhost:8090 # JWT security token file token=/etc/kuksa-dbc-feeder/dbc_feeder.json.token -# VSS mapping file -mapping=/etc/kuksa-dbc-feeder/mapping.yml [can] # CAN port diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml index ee970a32d..b1c1fece7 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml @@ -7,7 +7,7 @@ PT_VehicleAvgSpeed: PT_EngineSpeed: minupdatedelay: 100 targets: - Vehicle.Powertrain.CombustionEngine.Engine.Speed: + Vehicle.Powertrain.CombustionEngine.Speed: transform: math: "floor(x+0.5)" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb index b7538d771..b5597d003 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb @@ -2,31 +2,27 @@ SUMMARY = "DBC feeder for KUKSA.val, the KUKSA Vehicle Abstraction Layer" HOMEPAGE = "https://github.com/eclipse/kuksa.val" BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" -LICENSE = "EPL-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=d9fc0efef5228704e7f5b37f27192723" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=175792518e4ac015ab6696d16c4f607e" DEPENDS = "python3-setuptools-git-versioning-native" -require kuksa-val.inc +PV = "0.1.0+git${SRCPV}" -SRC_URI += "file://0001-dbc2val-add-installation-mechanism.patch \ - file://0002-dbc2val-usability-improvements.patch \ - file://0003-dbc2val-add-duplicate-filtering-option.patch \ - file://config.ini \ - file://dbc_feeder.json.token \ - file://mapping.yml \ - file://agl-vcar.dbc \ - file://kuksa-dbc-feeder.service \ +SRC_URI = "git://github.com/eclipse/kuksa.val.feeders.git;protocol=https;branch=main \ + file://0001-dbc2val-add-installation-mechanism.patch \ + file://0002-dbc2val-usability-improvements.patch \ + file://config.ini \ + file://dbc_feeder.json.token \ + file://mapping.yml \ + file://agl-vcar.dbc \ + file://kuksa-dbc-feeder.service \ " +SRCREV = "a857a1d6981b7d62b80ac03e60988a0bded3e255" -inherit setuptools3 systemd - -SETUPTOOLS_SETUP_PATH = "${S}/kuksa_feeders" +S = "${WORKDIR}/git" -# This is a bit of a workaround as the sed in distutils.bbclass -# will remove the -S already present in the script otherwise, -# breaking it. -PEP517_INSTALL_PYTHON = "-S python3 -u" +inherit setuptools3 systemd SYSTEMD_SERVICE:${PN} = "${BPN}.service" diff --git a/recipes-connectivity/kuksa-val/kuksa-val.inc b/recipes-connectivity/kuksa-val/kuksa-val.inc index ac7ff554a..6d9a5cc04 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val.inc +++ b/recipes-connectivity/kuksa-val/kuksa-val.inc @@ -1,7 +1,6 @@ -PV = "0.2.1+git${SRCPV}" +PV = "0.2.5+git${SRCPV}" SRC_URI = "gitsm://github.com/eclipse/kuksa.val.git;protocol=https;branch=master" -#SRCREV = "bf6f49224febd1c704a8686238a09e9a22350b9f" -SRCREV = "9c41bb36ddff3229dc7a48f57e3d13a32fb5999b" +SRCREV = "590198a35de7b2201bdd913750157bb9778a5214" S = "${WORKDIR}/git" diff --git a/recipes-connectivity/kuksa-val/kuksa-val/0001-Make-Boost-requirements-more-liberal.patch b/recipes-connectivity/kuksa-val/kuksa-val/0001-Make-Boost-requirements-more-liberal.patch index e351f0296..c00635090 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val/0001-Make-Boost-requirements-more-liberal.patch +++ b/recipes-connectivity/kuksa-val/kuksa-val/0001-Make-Boost-requirements-more-liberal.patch @@ -1,32 +1,23 @@ -From 6c1495df3c78a2e7d86ec141950f342835c0b8c7 Mon Sep 17 00:00:00 2001 +From aefa138ddb6b8af8287b14b748e9943e5d9ddb2e Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 23 May 2022 14:59:33 -0400 -Subject: [PATCH 1/4] Make Boost requirements more liberal +Date: Thu, 6 Oct 2022 11:56:38 -0400 +Subject: [PATCH 1/3] Make Boost requirements more liberal -To allow building with Yocto Project 3.1/dunfell or newer releases, -tweak the version requirement in boost.cmake to 1.72.0 and remove the -EXACT specifier from the find_package call. +To allow building with Yocto Project 4.0/kirkstone or newer releases, +remove the EXACT specifier from the Boost find_package call. Upstream-Status: Pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - boost.cmake | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + kuksa-val-server/boost.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/boost.cmake b/boost.cmake -index 9f0e512..2dff60a 100644 ---- a/boost.cmake -+++ b/boost.cmake -@@ -11,14 +11,14 @@ - # ***************************************************************************** - - set(Boost_USE_STATIC_LIBS OFF) --set(BOOST_VER 1.75.0) -+set(BOOST_VER 1.72.0) - set(Boost_NO_BOOST_CMAKE ON) - set(BOOST_COMPONENTS filesystem program_options system log thread) - ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK) +diff --git a/kuksa-val-server/boost.cmake b/kuksa-val-server/boost.cmake +index 54d7b2e..20a1e92 100644 +--- a/kuksa-val-server/boost.cmake ++++ b/kuksa-val-server/boost.cmake +@@ -18,7 +18,7 @@ ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK) # Workaround function to allow cmake call `find_package` twice. Avoide side effects from local variables, which are produced be `find_package` function(findBoost Required) @@ -36,5 +27,5 @@ index 9f0e512..2dff60a 100644 OPTIONAL_COMPONENTS unit_test_framework ) -- -2.35.1 +2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-val/0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch b/recipes-connectivity/kuksa-val/kuksa-val/0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch index 6569f8b5d..a7eaf1004 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val/0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch +++ b/recipes-connectivity/kuksa-val/kuksa-val/0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch @@ -1,7 +1,7 @@ -From f6c8584e181d3591b08e1f05a4f685912d7a94ce Mon Sep 17 00:00:00 2001 +From 09eba6eef270a3f75add5c54b5455399aecceaf6 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 23 May 2022 15:00:37 -0400 -Subject: [PATCH 2/4] Fix gRPC configuration for OE cross-compiling +Date: Thu, 6 Oct 2022 11:56:57 -0400 +Subject: [PATCH 2/3] Fix gRPC configuration for OE cross-compiling The gRPC CMake package that kuksa.val pulls in is problematic with respect to cross-compiling with OpenEmbedded's split native and @@ -10,27 +10,21 @@ match the (somewhat ill-advised) assumptions in the original upstream gRPC configuration. To work around this, a patch to gRPC is separately applied to split the plugins into their own optional package, and the logic in grpc.cmake here tweaked to -explicitly take cross-compilation into account. Additionally, the -explicit version requirement for gRPC is tweaked to 1.24.3 to allow -building with Yocto Project 3.1 aka dunfell or newer. +explicitly take cross-compilation into account. Upstream-Status: Pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - grpc.cmake | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) + kuksa-val-server/grpc.cmake | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) -diff --git a/grpc.cmake b/grpc.cmake -index c0228a0..30b3757 100644 ---- a/grpc.cmake -+++ b/grpc.cmake -@@ -11,17 +11,24 @@ - # ***************************************************************************** - - set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library") --set(GRPC_VER 1.44.0) -+set(GRPC_VER 1.24.3) +diff --git a/kuksa-val-server/grpc.cmake b/kuksa-val-server/grpc.cmake +index 4d90f1d..d097a69 100644 +--- a/kuksa-val-server/grpc.cmake ++++ b/kuksa-val-server/grpc.cmake +@@ -14,14 +14,21 @@ set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library") + set(GRPC_VER 1.44.0) find_package(Protobuf) -find_package(gRPC ${GRPC_VER} EXACT CONFIG) @@ -55,5 +49,5 @@ index c0228a0..30b3757 100644 set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) -- -2.35.1 +2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-val/0003-Make-install-locations-configurable.patch b/recipes-connectivity/kuksa-val/kuksa-val/0003-Make-install-locations-configurable.patch index ba5419a05..8375d07a3 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val/0003-Make-install-locations-configurable.patch +++ b/recipes-connectivity/kuksa-val/kuksa-val/0003-Make-install-locations-configurable.patch @@ -1,7 +1,7 @@ -From 535993001d8a24162e972b4a4e88387f94c9f539 Mon Sep 17 00:00:00 2001 +From b9df9bcf058e072e4c67dc8cc6ab41c3db745cbf Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 23 May 2022 15:21:07 -0400 -Subject: [PATCH 3/4] Make install locations configurable +Date: Thu, 6 Oct 2022 15:42:51 -0400 +Subject: [PATCH] Make install locations configurable Make binary, certificate, and configuration file install locations configurable, including generation and installation of an accurate @@ -15,47 +15,47 @@ Upstream-Status: Pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - config.ini | 7 ------- - config.ini.in | 7 +++++++ - src/CMakeLists.txt | 52 ++++++++++++++++++++++++++++++++++++---------- - src/config.hpp.in | 21 +++++++++++++++++++ - src/main.cpp | 5 +++-- - 5 files changed, 72 insertions(+), 20 deletions(-) - delete mode 100644 config.ini - create mode 100644 config.ini.in - create mode 100644 src/config.hpp.in + kuksa-val-server/config.ini | 7 ---- + kuksa-val-server/config.ini.in | 7 ++++ + kuksa-val-server/src/CMakeLists.txt | 54 ++++++++++++++++++++++------- + kuksa-val-server/src/config.hpp.in | 27 +++++++++++++++ + kuksa-val-server/src/main.cpp | 5 +-- + 5 files changed, 79 insertions(+), 21 deletions(-) + delete mode 100644 kuksa-val-server/config.ini + create mode 100644 kuksa-val-server/config.ini.in + create mode 100644 kuksa-val-server/src/config.hpp.in -diff --git a/config.ini b/config.ini +diff --git a/kuksa-val-server/config.ini b/kuksa-val-server/config.ini deleted file mode 100644 -index f3162d4..0000000 ---- a/config.ini +index 34326aa..0000000 +--- a/kuksa-val-server/config.ini +++ /dev/null @@ -1,7 +0,0 @@ --vss = vss_release_2.2.json +-vss = vss_release_3.0.json -log-level = ALL -cert-path = . - -[mqtt] - publish = - topic-prefix = vss -diff --git a/config.ini.in b/config.ini.in +diff --git a/kuksa-val-server/config.ini.in b/kuksa-val-server/config.ini.in new file mode 100644 -index 0000000..5bdce91 +index 0000000..3d888e5 --- /dev/null -+++ b/config.ini.in ++++ b/kuksa-val-server/config.ini.in @@ -0,0 +1,7 @@ -+vss = @KUKSA_DEFAULT_DATADIR@/vss_release_2.2.json ++vss = @KUKSA_DEFAULT_DATADIR@/vss_release_3.0.json +log-level = ALL +cert-path = @KUKSA_DEFAULT_CERTDIR@ + +[mqtt] + publish = + topic-prefix = vss -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 0ff5f9c..b7d4d4f 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -162,6 +162,35 @@ if(BUILD_EXE) +diff --git a/kuksa-val-server/src/CMakeLists.txt b/kuksa-val-server/src/CMakeLists.txt +index ea75ef7..e791a13 100644 +--- a/kuksa-val-server/src/CMakeLists.txt ++++ b/kuksa-val-server/src/CMakeLists.txt +@@ -161,6 +161,35 @@ if(BUILD_EXE) ###### # Setup server install and packaging @@ -88,58 +88,66 @@ index 0ff5f9c..b7d4d4f 100644 + configure_file(config.hpp.in config.hpp @ONLY) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/jwt/jwt.key.pub ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.pem ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.key ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) -@@ -171,19 +200,20 @@ if(BUILD_EXE) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.0.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.1.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.2.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/jwt/jwt.key.pub ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.pem ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.key ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) +@@ -171,20 +200,21 @@ if(BUILD_EXE) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.1.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.2.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_3.0.json ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../config.ini ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../config.ini.in ${CMAKE_CURRENT_BINARY_DIR}/config.ini @COPY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../config_grpc_client.ini ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - install( TARGETS ${SERVER_EXE_NAME} DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/jwt/jwt.key.pub DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.pem DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.key DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Client.pem DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Client.key DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/CA.pem DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.0.json DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.1.json DESTINATION bin/${SERVER_EXE_NAME}) -- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.2.json DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/jwt/jwt.key.pub DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.pem DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.key DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Client.pem DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Client.key DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/CA.pem DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.0.json DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.1.json DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.2.json DESTINATION bin/${SERVER_EXE_NAME}) +- install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_3.0.json DESTINATION bin/${SERVER_EXE_NAME}) + install( TARGETS ${SERVER_EXE_NAME} DESTINATION ${KUKSA_INSTALL_BINDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/jwt/jwt.key.pub DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Server.key DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Client.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/Client.key DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../kuksa_certificates/CA.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.0.json DESTINATION ${KUKSA_INSTALL_DATADIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.1.json DESTINATION ${KUKSA_INSTALL_DATADIR}) -+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../data/vss-core/vss_release_2.2.json DESTINATION ${KUKSA_INSTALL_DATADIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/jwt/jwt.key.pub DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Server.key DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Client.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/Client.key DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../kuksa_certificates/CA.pem DESTINATION ${KUKSA_INSTALL_CERTDIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.0.json DESTINATION ${KUKSA_INSTALL_DATADIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.1.json DESTINATION ${KUKSA_INSTALL_DATADIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_2.2.json DESTINATION ${KUKSA_INSTALL_DATADIR}) ++ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_3.0.json DESTINATION ${KUKSA_INSTALL_DATADIR}) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.ini DESTINATION ${KUKSA_INSTALL_CONFIGDIR}) - #GRPC client -diff --git a/src/config.hpp.in b/src/config.hpp.in + # CPack +diff --git a/kuksa-val-server/src/config.hpp.in b/kuksa-val-server/src/config.hpp.in new file mode 100644 -index 0000000..89586c2 +index 0000000..24226d2 --- /dev/null -+++ b/src/config.hpp.in -@@ -0,0 +1,21 @@ -+/* -+ * ****************************************************************************** ++++ b/kuksa-val-server/src/config.hpp.in +@@ -0,0 +1,27 @@ ++/********************************************************************** + * Copyright (c) 2022 Konsulko Group + * -+ * All rights reserved. This program and the accompanying materials -+ * are made available under the terms of the Eclipse Public License v2.0 -+ * which accompanies this distribution, and is available at -+ * https://www.eclipse.org/org/documents/epl-2.0/index.php ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at + * -+ * ***************************************************************************** -+ */ ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ * ++ * SPDX-License-Identifier: Apache-2.0 ++ **********************************************************************/ + +#ifndef __CONFIG_H___ + @@ -150,11 +158,11 @@ index 0000000..89586c2 +#cmakedefine KUKSA_DEFAULT_CERTDIR "@KUKSA_DEFAULT_CERTDIR@" + +#endif -diff --git a/src/main.cpp b/src/main.cpp -index 417e2e8..fdfeacd 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -40,6 +40,7 @@ +diff --git a/kuksa-val-server/src/main.cpp b/kuksa-val-server/src/main.cpp +index 234171a..2f7011a 100644 +--- a/kuksa-val-server/src/main.cpp ++++ b/kuksa-val-server/src/main.cpp +@@ -47,6 +47,7 @@ #include "exception.hpp" #include "grpcHandler.hpp" #include "OverlayLoader.hpp" @@ -162,7 +170,7 @@ index 417e2e8..fdfeacd 100644 #include "../buildinfo.h" -@@ -101,7 +102,7 @@ int main(int argc, const char *argv[]) { +@@ -106,7 +107,7 @@ int main(int argc, const char *argv[]) { program_options::options_description desc{"OPTIONS"}; desc.add_options() ("help,h", "Help screen") @@ -171,15 +179,15 @@ index 417e2e8..fdfeacd 100644 "Configuration file with `kuksa-val-server` input parameters." "Configuration file can replace command-line parameters and through different files multiple configurations can be handled more easily (e.g. test and production setup)." "Sample of configuration file parameters looks like:\n" -@@ -110,7 +111,7 @@ int main(int argc, const char *argv[]) { +@@ -115,7 +116,7 @@ int main(int argc, const char *argv[]) { "log-level = ALL\n") - ("vss", program_options::value<boost::filesystem::path>()->required(), "[mandatory] Path to VSS data file describing VSS data tree structure which `kuksa-val-server` shall handle. Sample 'vss_release_2.1.json' file can be found under [data](./data/vss-core/vss_release_2.1.json)") + ("vss", program_options::value<boost::filesystem::path>()->required(), "[mandatory] Path to VSS data file describing VSS data tree structure which `kuksa-val-server` shall handle. Sample 'vss_release_3.0.json' file can be found under [data](./data/vss-core/vss_release_3.0.json)") ("overlays", program_options::value<boost::filesystem::path>(), "Path to a directory cotaiing additional VSS models. All json files will be applied on top of the main vss file given by the -vss parameter in alphanumerical order") - ("cert-path", program_options::value<boost::filesystem::path>()->required()->default_value(boost::filesystem::path(".")), + ("cert-path", program_options::value<boost::filesystem::path>()->required()->default_value(boost::filesystem::path(KUKSA_DEFAULT_CERTDIR)), "[mandatory] Directory path where 'Server.pem', 'Server.key' and 'jwt.key.pub' are located. ") - ("insecure", program_options::bool_switch()->default_value(false), "By default, `kuksa-val-server` shall accept only SSL (TLS) secured connections. If provided, `kuksa-val-server` shall also accept plain un-secured connections for Web-Socket and REST API connections, and also shall not fail connections due to self-signed certificates.") + ("insecure", program_options::bool_switch()->default_value(false), "By default, `kuksa-val-server` shall accept only SSL (TLS) secured connections. If provided, `kuksa-val-server` shall also accept plain un-secured connections for Web-Socket and GRPC API connections, and also shall not fail connections due to self-signed certificates.") ("use-keycloak", "Use KeyCloak for permission management") -- -2.35.1 +2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-val/0004-Disable-default-fetch-and-build-of-googletest.patch b/recipes-connectivity/kuksa-val/kuksa-val/0004-Disable-default-fetch-and-build-of-googletest.patch index 9225aa552..8dc8b213c 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val/0004-Disable-default-fetch-and-build-of-googletest.patch +++ b/recipes-connectivity/kuksa-val/kuksa-val/0004-Disable-default-fetch-and-build-of-googletest.patch @@ -1,7 +1,7 @@ -From 73701bc4ac7e0c21990f73139839bc633afdd772 Mon Sep 17 00:00:00 2001 +From 21a33ac3b07b00b510c80f50bde7cc42dcada039 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Tue, 24 May 2022 10:21:44 -0400 -Subject: [PATCH 4/4] Disable default fetch and build of googletest +Date: Thu, 6 Oct 2022 13:31:02 -0400 +Subject: [PATCH 3/3] Disable default fetch and build of googletest The logic in test/unit-test/CMakeLists.txt was always fetching and building googletest even if the unit-test was not enabled (which is @@ -12,13 +12,13 @@ Upstream-Status: Pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - test/unit-test/CMakeLists.txt | 42 +++++++++++++++++------------------ + .../test/unit-test/CMakeLists.txt | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) -diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt -index 873d604..976eb18 100644 ---- a/test/unit-test/CMakeLists.txt -+++ b/test/unit-test/CMakeLists.txt +diff --git a/kuksa-val-server/test/unit-test/CMakeLists.txt b/kuksa-val-server/test/unit-test/CMakeLists.txt +index 55eedc9..6cec94f 100644 +--- a/kuksa-val-server/test/unit-test/CMakeLists.txt ++++ b/kuksa-val-server/test/unit-test/CMakeLists.txt @@ -16,18 +16,6 @@ enable_testing() include(CTest) include(FetchContent) @@ -79,5 +79,5 @@ index 873d604..976eb18 100644 AccessCheckerTests.cpp AuthenticatorTests.cpp -- -2.35.1 +2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-val_git.bb b/recipes-connectivity/kuksa-val/kuksa-val_git.bb index 8bfa5ab67..cd1bb18d7 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-val_git.bb @@ -3,8 +3,8 @@ DESCRIPTION = "KUKSA.val provides a COVESA VSS data model describing data in a v HOMEPAGE = "https://github.com/eclipse/kuksa.val" BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" -LICENSE = "EPL-2.0 & BSL-1.0 & MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=d9fc0efef5228704e7f5b37f27192723 \ +LICENSE = "Apache-2.0 & BSL-1.0 & MIT" +LIC_FILES_CHKSUM = "file://../LICENSE;md5=2b42edef8fa55315f34f2370b4715ca9 \ file://3rd-party-libs/jsoncons/LICENSE;md5=6ee7f7ed2001e4cde4679fdb8926f820 \ file://3rd-party-libs/turtle/LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c \ file://3rd-party-libs/jwt-cpp/LICENSE;md5=8325a5ce4414c65ffdda392e0d96a9ff" @@ -14,14 +14,17 @@ DEPENDS = "boost openssl mosquitto protobuf-native grpc-native grpc" require kuksa-val.inc SRC_URI += "file://kuksa-val.service \ - file://0001-Make-Boost-requirements-more-liberal.patch \ - file://0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch \ - file://0003-Make-install-locations-configurable.patch \ - file://0004-Disable-default-fetch-and-build-of-googletest.patch \ - file://0001-genCerts.sh-add-Subject-Alt-Name-extension-to-server.patch \ + file://0001-Make-Boost-requirements-more-liberal.patch;striplevel=2 \ + file://0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch;striplevel=2 \ + file://0003-Make-install-locations-configurable.patch;striplevel=2 \ + file://0004-Disable-default-fetch-and-build-of-googletest.patch;striplevel=2 \ file://Server.key \ file://Server.pem \ " +# file://0001-genCerts.sh-add-Subject-Alt-Name-extension-to-server.patch;striplevel=? \ +# + +S = "${WORKDIR}/git/kuksa-val-server" inherit cmake pkgconfig systemd useradd diff --git a/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-Update-kuksa-viss-client-to-support-Python-3.10.patch b/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-Update-kuksa-viss-client-to-support-Python-3.10.patch deleted file mode 100644 index f1813e586..000000000 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-Update-kuksa-viss-client-to-support-Python-3.10.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 9c0d93ef3b7266037a1c8fe7e49790f9119dae28 Mon Sep 17 00:00:00 2001 -From: Erik Jaegervall <erik.jaegervall@se.bosch.com> -Date: Wed, 31 Aug 2022 14:41:07 +0200 -Subject: [PATCH] Update kuksa-viss-client to support Python 3.10 - -SSH checks in Python 3.10 are stricter. -Using current version with Python 3.10 gives the following error: - -Disconnected!! Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801) - -Changing to default context (i.e. implictly Purpose.SERVER_AUTH) -Also ignoring hostname check as certificate does not include correct hostname -Updating Docker build to use Python 3.10 - -Signed-off-by: Erik Jaegervall <erik.jaegervall@se.bosch.com> - -Upstream-Status: Backport [https://github.com/eclipse/kuksa.val/commit/9c0d93ef3b7266037a1c8fe7e49790f9119dae28] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - kuksa_viss_client/Dockerfile | 2 +- - kuksa_viss_client/__init__.py | 5 ++++- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/kuksa_viss_client/Dockerfile b/kuksa_viss_client/Dockerfile -index ae62e50..bf0f49e 100644 ---- a/kuksa_viss_client/Dockerfile -+++ b/kuksa_viss_client/Dockerfile -@@ -18,7 +18,7 @@ RUN python -m build - RUN mkdir /kuksa_viss_client - RUN pip install --target /kuksa_viss_client --no-cache-dir dist/*.whl - --FROM python:3.8-alpine -+FROM python:3.10-alpine - - COPY --from=build /kuksa_viss_client /kuksa_viss_client - ENV PYTHONUNBUFFERED=yes -diff --git a/kuksa_viss_client/__init__.py b/kuksa_viss_client/__init__.py -index 69cc996..ab29fb9 100644 ---- a/kuksa_viss_client/__init__.py -+++ b/kuksa_viss_client/__init__.py -@@ -227,9 +227,12 @@ class KuksaClientThread(threading.Thread): - - async def mainLoop(self): - if not self.insecure: -- context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) -+ context = ssl.create_default_context() - context.load_cert_chain(certfile=self.certificate, keyfile=self.keyfile) - context.load_verify_locations(cafile=self.cacertificate) -+ # Certificates in ../kuksa_certificates does not contain the IP address used for -+ # connection to server so hostname check must be disabled -+ context.check_hostname = False - try: - print("connect to wss://"+self.serverIP+":"+str(self.serverPort)) - async with websockets.connect("wss://"+self.serverIP+":"+str(self.serverPort), ssl=context) as ws: --- -2.34.1 - diff --git a/recipes-connectivity/kuksa-val/kuksa-viss-client/0002-kuksa_viss_client-Update-cmd2-completer-usage.patch b/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-kuksa_viss_client-Update-cmd2-completer-usage.patch index 944d8bb1a..acd416911 100644 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client/0002-kuksa_viss_client-Update-cmd2-completer-usage.patch +++ b/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-kuksa_viss_client-Update-cmd2-completer-usage.patch @@ -1,23 +1,24 @@ -From 525122ade01998e34eabce74cb24d1c427c4b48d Mon Sep 17 00:00:00 2001 +From 1da7b980d05706c8d4e9bcb0d12965258a4fc709 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Wed, 21 Sep 2022 13:27:49 -0400 +Date: Thu, 6 Oct 2022 16:07:00 -0400 Subject: [PATCH] kuksa_viss_client: Update cmd2 completer usage Update cmd2 usage to avoid using internal methods and fix breakage with newer versions of the cmd2 module. Upstream-Status: pending + Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - kuksa_viss_client/__main__.py | 28 ++++++++++++++-------------- - 1 file changed, 14 insertions(+), 14 deletions(-) + kuksa_viss_client/__main__.py | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/kuksa_viss_client/__main__.py b/kuksa_viss_client/__main__.py -index 4d61433..d0b1af3 100755 +index 5e595f8..e5798b8 100755 --- a/kuksa_viss_client/__main__.py +++ b/kuksa_viss_client/__main__.py -@@ -14,7 +14,7 @@ from typing import Dict, List - import queue, time, os +@@ -23,7 +23,7 @@ from typing import Dict, List + import queue, time, os, threading from pygments import highlight, lexers, formatters from cmd2 import Cmd, with_argparser, with_category, Cmd2ArgumentParser, CompletionItem -from cmd2.utils import CompletionError, basic_complete @@ -25,16 +26,16 @@ index 4d61433..d0b1af3 100755 import functools, subprocess DEFAULT_SERVER_ADDR = "127.0.0.1" DEFAULT_SERVER_PORT = 8090 -@@ -82,7 +82,7 @@ class TestClient(Cmd): +@@ -103,7 +103,7 @@ class TestClient(Cmd): + if 'children' in child: self.pathCompletionItems.append(CompletionItem(prefix + key+seperator, "Children of branch "+prefix+key)) - - return basic_complete(text, line, begidx, endidx, self.pathCompletionItems) + return Cmd.basic_complete(self, text, line, begidx, endidx, self.pathCompletionItems) def subscribeCallback(self, path, attr, resp): - print(path, attr) -@@ -93,7 +93,7 @@ class TestClient(Cmd): + self.subscribeFileDesc[(path,attr)].write(resp + "\n") +@@ -113,7 +113,7 @@ class TestClient(Cmd): self.pathCompletionItems = [] for id in self.subscribeIdToPath.keys(): self.pathCompletionItems.append(CompletionItem(id)) @@ -43,7 +44,7 @@ index 4d61433..d0b1af3 100755 COMM_SETUP_COMMANDS = "Communication Set-up Commands" VISS_COMMANDS = "Kuksa Interaction Commands" -@@ -106,44 +106,44 @@ class TestClient(Cmd): +@@ -126,45 +126,45 @@ class TestClient(Cmd): ap_authorize = argparse.ArgumentParser() tokenfile_completer_method = functools.partial(Cmd.path_complete, path_filter=lambda path: (os.path.isdir(path) or path.endswith(".token"))) @@ -51,18 +52,19 @@ index 4d61433..d0b1af3 100755 + ap_authorize.add_argument('Token', help='JWT(or the file storing the token) for authorizing the client.', completer=tokenfile_completer_method) ap_setServerAddr = argparse.ArgumentParser() ap_setServerAddr.add_argument('IP', help='VISS Server IP Address', default=DEFAULT_SERVER_ADDR) - ap_setServerAddr.add_argument('Port', type=int, help='VISS Server Websocket Port', default=DEFAULT_SERVER_PORT) + ap_setServerAddr.add_argument('Port', type=int, help='VISS Server Port', default=DEFAULT_SERVER_PORT) + ap_setServerAddr.add_argument('-p', "--protocol", help='VISS Server Communication Protocol (ws or grpc)', default=DEFAULT_SERVER_PROTOCOL) ap_setValue = argparse.ArgumentParser() - ap_setValue.add_argument("Path", help="Path to be set", completer_method=path_completer) + ap_setValue.add_argument("Path", help="Path to be set", completer=path_completer) ap_setValue.add_argument("Value", help="Value to be set") - ap_setValue.add_argument("Attribute", help="Attribute to be set", default="value", nargs=(0,1)) + ap_setValue.add_argument("-a", "--attribute", help="Attribute to be set", default="value") ap_getValue = argparse.ArgumentParser() - ap_getValue.add_argument("Path", help="Path to be read", completer_method=path_completer) + ap_getValue.add_argument("Path", help="Path to be read", completer=path_completer) - ap_getValue.add_argument("Attribute", help="Attribute to be get", default="value", nargs=(0,1)) + ap_getValue.add_argument("-a", "--attribute", help="Attribute to be get", default="value") ap_setTargetValue = argparse.ArgumentParser() - ap_setTargetValue.add_argument("Path", help="Path whose target value to be set", completer_method=path_completer) @@ -75,9 +77,8 @@ index 4d61433..d0b1af3 100755 ap_subscribe = argparse.ArgumentParser() - ap_subscribe.add_argument("Path", help="Path to be subscribed", completer_method=path_completer) -- ap_subscribe.add_argument("Attribute", help="Attribute to be subscribed", default="value", completer_method=path_completer, nargs=(0,1)) + ap_subscribe.add_argument("Path", help="Path to be subscribed", completer=path_completer) -+ ap_subscribe.add_argument("Attribute", help="Attribute to be subscribed", default="value", completer=path_completer, nargs=(0,1)) + ap_subscribe.add_argument("-a", "--attribute", help="Attribute to be subscribed", default="value") ap_unsubscribe = argparse.ArgumentParser() - ap_unsubscribe.add_argument("SubscribeId", help="Corresponding subscription Id", completer_method=subscriptionIdCompleter) @@ -97,8 +98,8 @@ index 4d61433..d0b1af3 100755 - ap_updateVSSTree.add_argument("Json", help="Json tree to update VSS", completer_method=jsonfile_completer_method) + ap_updateVSSTree.add_argument("Json", help="Json tree to update VSS", completer=jsonfile_completer_method) - # Constructor + def __init__(self): -- 2.37.3 diff --git a/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb b/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb index 67f4af254..2a4026bd6 100644 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb @@ -2,18 +2,22 @@ SUMMARY = "Python client for KUKSA.val, the KUKSA Vehicle Abstraction Layer" HOMEPAGE = "https://github.com/eclipse/kuksa.val" BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" -LICENSE = "EPL-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=d9fc0efef5228704e7f5b37f27192723" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://../LICENSE;md5=2b42edef8fa55315f34f2370b4715ca9" -DEPENDS = "python3-setuptools-git-versioning-native" +DEPENDS = " \ + python3-setuptools-git-versioning-native \ + python3-grpcio-tools-native \ + python3-grpcio \ +" require kuksa-val.inc -SRC_URI += "file://0001-Update-kuksa-viss-client-to-support-Python-3.10.patch \ - file://0002-kuksa_viss_client-Update-cmd2-completer-usage.patch \ -" +SRC_URI += "file://0001-kuksa_viss_client-Update-cmd2-completer-usage.patch;striplevel=2" + +S = "${WORKDIR}/git/kuksa_viss_client" -inherit setuptools3 +inherit python_setuptools_build_meta RDEPENDS:${PN} += " \ python3-cmd2 \ @@ -21,6 +25,9 @@ RDEPENDS:${PN} += " \ python3-pkg-resources \ python3-pygments \ python3-websockets \ + python3-grpcio \ + python3-grpcio-tools \ + python3-jsonpath-ng \ " # A script for generating new certificates currently gets shipped inside diff --git a/recipes-devtools/python/python3-jsonpath-ng_1.5.3.bb b/recipes-devtools/python/python3-jsonpath-ng_1.5.3.bb new file mode 100644 index 000000000..4c3dfaa94 --- /dev/null +++ b/recipes-devtools/python/python3-jsonpath-ng_1.5.3.bb @@ -0,0 +1,15 @@ +SUMMARY = "A final implementation of JSONPath for Python that aims to be standard compliant, including arithmetic and binary comparison operators and providing clear AST for metaprogramming." +HOMEPAGE = "https://github.com/h2non/jsonpath-ng" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +PYPI_PACKAGE = "jsonpath-ng" + +SRC_URI[sha256sum] = "a273b182a82c1256daab86a313b937059261b5c5f8c4fa3fc38b882b344dd567" + +inherit pypi setuptools3 + +RDEPENDS:${PN} += " \ + python3-ply \ + python3-six \ +" |