diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-04-18 16:11:47 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2023-05-16 14:03:50 +0000 |
commit | f6a2980917592000382d2a9af9ea4803e90f9f88 (patch) | |
tree | 23a0def2ee2c547f2f9f6e9cfbf0cbc7f3d63379 | |
parent | addb673cf642c1b06bfa912baf1aabbce5297400 (diff) |
kuksa-val: Update to 0.3.1
Changes:
- Update kuksa-val to a commit that includes the 0.3.1 release and
some other fixes past that. Our local patches have been updated.
- Rework and rename the kuksa-viss-client recipe for the upstream
switch to kuksa-client as the name. Our local patches have been
updated.
- Update kuksa-dbc-feeder to a commit that supports the kuksa-client
library changes that come with 0.3.1. Our local patches have been
updated, and a new local patch has been added to fix the token file
configuration option behavior, this will be worked with upstream.
Upstream changed the configuration file format, so our local one
has also been updated to match.
- Update the parsing of the DBC feeder configuration file in the
can-dev-helper.sh script to work with the new format.
- Update kuksa-val-agl recipe to not install AGL signals overlay
for VSS, as that has been replaced with the use of the vss-agl
package.
- Add installation of vss-agl to packagegroup-agl-ivi-services so
the AGL specific signals and DBC configuration will be available.
Bug-AGL: SPEC-4761
Change-Id: I5933017a30f040a746f0a6a6eb2a3b68d1fc4bc1
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
17 files changed, 334 insertions, 555 deletions
diff --git a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh index 69dc62831..d57604c07 100644 --- a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh +++ b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh @@ -25,7 +25,7 @@ fi # Ideally the parsing would take the "[can]" section into # account, but this should work for now. -interface=$(grep ^port= $CONF |cut -d= -f2 |tr -d '"') +interface=$(sed -nr '/\[can\]/,/\[/{s/^port *= *//p}' $CONF) if [ -n "$interface" ]; then echo "Checking $interface" if ! ifconfig $interface >/dev/null 2>&1; then diff --git a/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch b/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch new file mode 100644 index 000000000..55e9cc2cb --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch @@ -0,0 +1,141 @@ +From ea0b48b9a900e9ce6d898fc5d17ae3238aadb289 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Tue, 2 May 2023 16:20:40 -0400 +Subject: [PATCH 2/2] 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-client/kuksa_client/__main__.py | 31 +++++++++++++-------------- + 1 file changed, 15 insertions(+), 16 deletions(-) + +diff --git a/kuksa-client/kuksa_client/__main__.py b/kuksa-client/kuksa_client/__main__.py +index c34f335..d386708 100755 +--- a/kuksa-client/kuksa_client/__main__.py ++++ b/kuksa-client/kuksa_client/__main__.py +@@ -34,7 +34,6 @@ from cmd2 import Cmd + from cmd2 import CompletionItem + from cmd2 import with_argparser + from cmd2 import with_category +-from cmd2.utils import basic_complete + + import kuksa_certificates + from kuksa_client import KuksaClientThread +@@ -122,7 +121,7 @@ class TestClient(Cmd): + "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, logPath, resp): + with logPath.open('a', encoding='utf-8') as logFile: +@@ -132,7 +131,7 @@ class TestClient(Cmd): + self.pathCompletionItems = [] + for sub_id in self.subscribeIds: + self.pathCompletionItems.append(CompletionItem(sub_id)) +- return basic_complete(text, line, begidx, endidx, self.pathCompletionItems) ++ return Cmd.basic_complete(self, text, line, begidx, endidx, self.pathCompletionItems) + + COMM_SETUP_COMMANDS = "Communication Set-up Commands" + VSS_COMMANDS = "Kuksa Interaction Commands" +@@ -149,7 +148,7 @@ class TestClient(Cmd): + ap_authorize.add_argument( + 'token_or_tokenfile', + help='JWT(or the file storing the token) for authorizing the client.', +- completer_method=tokenfile_completer_method,) ++ completer=tokenfile_completer_method,) + ap_setServerAddr = argparse.ArgumentParser() + ap_setServerAddr.add_argument( + 'IP', help='VISS/gRPC Server IP Address', default=DEFAULT_SERVER_ADDR) +@@ -164,7 +163,7 @@ class TestClient(Cmd): + + ap_setValue = argparse.ArgumentParser() + ap_setValue.add_argument( +- "Path", help="Path to be set", completer_method=path_completer) ++ "Path", help="Path to be set", completer=path_completer) + ap_setValue.add_argument("Value", help="Value to be set") + ap_setValue.add_argument( + "-a", "--attribute", help="Attribute to be set", default="value") +@@ -181,19 +180,19 @@ class TestClient(Cmd): + + ap_getValue = argparse.ArgumentParser() + ap_getValue.add_argument( +- "Path", help="Path to be read", completer_method=path_completer) ++ "Path", help="Path to be read", completer=path_completer) + ap_getValue.add_argument( + "-a", "--attribute", help="Attribute to be get", default="value") + + ap_getValues = argparse.ArgumentParser() + ap_getValues.add_argument( +- "Path", help="Path whose value is to be read", nargs='+', completer_method=path_completer) ++ "Path", help="Path whose value is to be read", nargs='+', completer=path_completer) + ap_getValues.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) ++ "Path", help="Path whose target value to be set", completer=path_completer) + ap_setTargetValue.add_argument("Value", help="Value to be set") + + ap_setTargetValues = argparse.ArgumentParser() +@@ -206,35 +205,35 @@ class TestClient(Cmd): + + ap_getTargetValue = argparse.ArgumentParser() + ap_getTargetValue.add_argument( +- "Path", help="Path whose target value is to be read", completer_method=path_completer) ++ "Path", help="Path whose target value is to be read", completer=path_completer) + + ap_getTargetValues = argparse.ArgumentParser() + ap_getTargetValues.add_argument( +- "Path", help="Path whose target value is to be read", nargs='+', completer_method=path_completer) ++ "Path", help="Path whose target value is to be read", nargs='+', completer=path_completer) + + ap_subscribe = argparse.ArgumentParser() + ap_subscribe.add_argument( +- "Path", help="Path to subscribe to", completer_method=path_completer) ++ "Path", help="Path to subscribe to", completer=path_completer) + ap_subscribe.add_argument( + "-a", "--attribute", help="Attribute to subscribe to", default="value") + + ap_subscribeMultiple = argparse.ArgumentParser() + ap_subscribeMultiple.add_argument( +- "Path", help="Path to subscribe to", nargs='+', completer_method=path_completer) ++ "Path", help="Path to subscribe to", nargs='+', completer=path_completer) + ap_subscribeMultiple.add_argument( + "-a", "--attribute", help="Attribute to subscribe to", default="value") + + ap_unsubscribe = argparse.ArgumentParser() + ap_unsubscribe.add_argument( +- "SubscribeId", help="Corresponding subscription Id", completer_method=subscriptionIdCompleter, ++ "SubscribeId", help="Corresponding subscription Id", completer=subscriptionIdCompleter, + ) + + ap_getMetaData = argparse.ArgumentParser() + ap_getMetaData.add_argument( +- "Path", help="Path whose metadata is to be read", completer_method=path_completer) ++ "Path", help="Path whose metadata is to be read", completer=path_completer) + ap_updateMetaData = argparse.ArgumentParser() + ap_updateMetaData.add_argument( +- "Path", help="Path whose MetaData is to update", completer_method=path_completer) ++ "Path", help="Path whose MetaData is to update", completer=path_completer) + ap_updateMetaData.add_argument( + "Json", + help="MetaData to update. Note, only attributes can be update, if update children or the whole vss tree, use" +@@ -245,7 +244,7 @@ class TestClient(Cmd): + jsonfile_completer_method = functools.partial(Cmd.path_complete, + path_filter=lambda path: (os.path.isdir(path) or path.endswith(".json"))) + ap_updateVSSTree.add_argument( +- "Json", help="Json tree to update VSS", completer_method=jsonfile_completer_method) ++ "Json", help="Json tree to update VSS", completer=jsonfile_completer_method) + + # Constructor + def __init__(self, server_ip=None, server_port=None, server_protocol=None, insecure=False, token_or_tokenfile=None): +-- +2.39.2 + diff --git a/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch b/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch new file mode 100644 index 000000000..229dda46a --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch @@ -0,0 +1,51 @@ +From 3c9f74492153817dc4fa405c1724fbf22ce58c98 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Tue, 2 May 2023 16:19:55 -0400 +Subject: [PATCH 1/2] kuksa_viss_client: Add external certificates support + +Tweak the definition of __certificate_dir__ in the kuksa_certificates +package, and certificate location logic in the client library to allow +picking up alternative certificates from /etc/kuksa-certificates or +/etc/kuksa-val before falling back to the shipped defaults. The +intent is to allow packagers to more straighhtforwardly use their own +certificates with both the server and clients. + +Upstream-Status: pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + kuksa-client/kuksa_client/cli_backend/__init__.py | 2 +- + kuksa_certificates/__init__.py | 7 ++++++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/kuksa-client/kuksa_client/cli_backend/__init__.py b/kuksa-client/kuksa_client/cli_backend/__init__.py +index d282a0c..3052859 100644 +--- a/kuksa-client/kuksa_client/cli_backend/__init__.py ++++ b/kuksa-client/kuksa_client/cli_backend/__init__.py +@@ -29,7 +29,7 @@ class Backend: + self.insecure = config.getboolean('insecure', False) + except AttributeError: + self.insecure = config.get('insecure', False) +- self.default_cert_path = pathlib.Path(kuksa_certificates.__path__[0]) ++ self.default_cert_path = pathlib.Path(kuksa_certificates.__certificate_dir__) + self.cacertificate = config.get( + 'cacertificate', str(self.default_cert_path / 'CA.pem')) + self.certificate = config.get('certificate', str( +diff --git a/kuksa_certificates/__init__.py b/kuksa_certificates/__init__.py +index 22ccd3f..8323868 100644 +--- a/kuksa_certificates/__init__.py ++++ b/kuksa_certificates/__init__.py +@@ -2,4 +2,9 @@ import os + + from kuksa_client._metadata import * + +-__certificate_dir__= os.path.dirname(os.path.realpath(__file__)) ++if os.path.isdir("/etc/kuksa-certificates"): ++ __certificate_dir__= "/etc/kuksa-certificates" ++elif os.path.isdir("/etc/kuksa-val"): ++ __certificate_dir__= "/etc/kuksa-val" ++else: ++ __certificate_dir__= os.path.dirname(os.path.realpath(__file__)) +-- +2.39.2 + diff --git a/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb b/recipes-connectivity/kuksa-val/kuksa-client_git.bb index 7cefeb018..b56a455b6 100644 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-client_git.bb @@ -13,11 +13,11 @@ DEPENDS = " \ require kuksa-val.inc -SRC_URI += "file://0001-kuksa_viss_client-Update-cmd2-completer-usage.patch;patchdir=.. \ - file://0002-kuksa_viss_client-Add-external-certificates-support.patch;patchdir=.. \ +SRC_URI += "file://0001-kuksa-client-Update-cmd2-completer-usage.patch;patchdir=.. \ + file://0002-kuksa-client-Add-external-certificates-support.patch;patchdir=.. \ " -S = "${WORKDIR}/git/kuksa_viss_client" +S = "${WORKDIR}/git/kuksa-client" inherit python_setuptools_build_meta 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 4221df5c8..527266f27 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,215 +1,41 @@ -From 22062d99a89922e02b626e4701feaac8947af5fb Mon Sep 17 00:00:00 2001 +From c3774fed42d58f227a4ecb501c6ef1dd3a9cfcf3 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Fri, 7 Oct 2022 15:54:48 -0400 +Date: Wed, 19 Apr 2023 15:55:01 -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. +Add setup.py and setup.cfg to allow installing the dbcfeederlib +module and dbcfeeder.py in a way suitable for packaging. Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +%% original patch: 0001-dbc2val-add-installation-mechanism.patch --- - 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 + dbc2val/setup.cfg | 30 ++++++++++++++++++++++++++++++ + dbc2val/setup.py | 14 ++++++++++++++ + 2 files changed, 44 insertions(+) + create mode 100644 dbc2val/setup.cfg + create mode 100644 dbc2val/setup.py -diff --git a/dbc2val/__init__.py b/dbc2val/__init__.py -new file mode 100644 -index 0000000..e69de29 -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 - - log = logging.getLogger(__name__) -@@ -33,13 +33,13 @@ class mapper: - self.mapping = yaml.full_load(file) - - 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() - - 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/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 -+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 +diff --git a/dbc2val/setup.cfg b/dbc2val/setup.cfg new file mode 100644 -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 +index 0000000..03dc6d6 --- /dev/null -+++ b/setup.cfg -@@ -0,0 +1,31 @@ ++++ b/dbc2val/setup.cfg +@@ -0,0 +1,30 @@ +[metadata] -+name = dbc2val ++name = dbcfeeder +author = Sebastian Schildt, Naresh Nayak, Wenwen Chen +author_email = sebastian.schildt@de.bosch.com, naresh.nayak@de.bosch.com, wenwen.chen@de.bosch.com +description = kuksa.val DBC feeder +long_description = file:README.md +long_description_content_type = text/markdown -+url=https://github.com/eclipse/kuksa.val ++url=https://github.com/eclipse/kuksa.val.feeders +project_urls= -+ Source=https://github.com/eclipse/kuksa.val/tree/master/kuksa_feeders/dbc2val -+ Bug Tracker=https://github.com/eclipse/kuksa.val/issues -+classifiers = ++ Source=https://github.com/eclipse/kuksa.val.feeders/tree/master/dbc2val ++ Bug Tracker=https://github.com/eclipse/kuksa.val.feeders/issues ++classifiers = + Intended Audience :: Developers + Development Status :: 3 - Alpha + Environment :: Console @@ -217,46 +43,24 @@ index 0000000..70aab60 + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent + Topic :: Software Development -+ -+license_file = LICENSE.txt ++ ++license_file = ../LICENSE.txt + +[options] +python_requires = >=3.6 +install_requires= + pyserial + pyyaml -+ kuksa-viss-client -+packages=find: -+include_package_data = True -+scripts=dbc2val/dbcfeeder.py -diff --git a/setup.py b/setup.py ++ kuksa-client ++packages=dbcfeederlib ++scripts=dbcfeeder.py +diff --git a/dbc2val/setup.py b/dbc2val/setup.py new file mode 100644 -index 0000000..55951cc +index 0000000..65f9157 --- /dev/null -+++ b/setup.py -@@ -0,0 +1,36 @@ -+# To avoid shipping dbcfeeder.py in the module itself, use the -+# technique outlined at: -+# -+# https://stackoverflow.com/a/50592100 -+# -+# This can be removed if the directory structure is ever reorganized -+# more along the lines of upstream recommendations. -+# -+ -+import fnmatch -+from setuptools import find_packages, setup -+from setuptools.command.build_py import build_py as build_py_orig -+ -+exclude = ['dbc2val.dbcfeeder'] -+ -+class build_py(build_py_orig): -+ def find_package_modules(self, package, package_dir): -+ modules = super().find_package_modules(package, package_dir) -+ print("modules = %s" % modules) -+ return [(pkg, mod, file, ) for (pkg, mod, file, ) in modules -+ if not any(fnmatch.fnmatchcase(pkg + '.' + mod, pat=pattern) -+ for pattern in exclude)] ++++ b/dbc2val/setup.py +@@ -0,0 +1,14 @@ ++from setuptools import setup + +setup( + version_config={ @@ -269,8 +73,7 @@ index 0000000..55951cc + "count_commits_from_version_file": False + }, + setup_requires=['setuptools-git-versioning'], -+ cmdclass={'build_py': build_py}, +) -- -2.37.3 +2.39.2 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 be88fa0ee..a3dd31be4 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,6 +1,6 @@ -From d0730c0d643738ac683d1b5c19b117893e3b2049 Mon Sep 17 00:00:00 2001 +From 91fb1f5a92e8784446c4e354fe5a8c465d6b3cb8 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Tue, 11 Oct 2022 15:28:07 -0400 +Date: Tue, 2 May 2023 16:27:04 -0400 Subject: [PATCH 2/2] dbc2val: usability improvements Changes: @@ -18,24 +18,16 @@ Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - dbc2val/dbcfeeder.py | 21 +++++++++++++++------ - dbc2val/dbcreader.py | 12 ++++++++---- - 2 files changed, 23 insertions(+), 10 deletions(-) + dbc2val/dbcfeeder.py | 10 ++++++++-- + dbc2val/dbcfeederlib/dbcreader.py | 11 ++++++++--- + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py -index 7daaa2b..33c2212 100755 +index d32bb04..b73b96e 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 +@@ -170,7 +170,11 @@ class Feeder: - 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) @@ -44,60 +36,29 @@ index 7daaa2b..33c2212 100755 + 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): + + self._run() + +@@ -278,8 +282,10 @@ def parse_config(filename): configfile = filename else: config_candidates = [ - "/config/dbc_feeder.ini", + "/etc/kuksa-dbc-feeder/config.ini", ++ "/etc/kuksa-dbc-feeder/dbc_feeder.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: + for candidate in config_candidates: +diff --git a/dbc2val/dbcfeederlib/dbcreader.py b/dbc2val/dbcfeederlib/dbcreader.py +index 5dad41f..c2f5b55 100644 +--- a/dbc2val/dbcfeederlib/dbcreader.py ++++ b/dbc2val/dbcfeederlib/dbcreader.py +@@ -56,8 +56,8 @@ class DBCReader: Bitrate in bit/s. """ - self.bus = can.interface.Bus(*args, **kwargs) + self.bus = can.interface.Bus(*args, **kwargs) # pylint: disable=abstract-class-instantiated - rxThread = threading.Thread(target=self.rxWorker) - rxThread.start() + self.rxThread = threading.Thread(target=self.rxWorker) @@ -105,7 +66,7 @@ index 2500832..b537a4d 100644 def get_whitelist(self): log.info("Collecting signals, generating CAN ID whitelist") -@@ -83,7 +83,10 @@ class DBCReader: +@@ -86,7 +86,10 @@ class DBCReader: def rxWorker(self): log.info("Starting Rx thread") while self.run: @@ -114,16 +75,15 @@ index 2500832..b537a4d 100644 + msg = self.bus.recv(timeout=1) + except Exception: + break + log.debug("processing message from CAN bus") 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: +@@ -113,3 +116,5 @@ class DBCReader: def stop(self): self.run = False -- + self.bus.shutdown() + self.rxThread.join() -- -2.37.3 +2.39.2 diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-fix-token-file-configuration-option.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-fix-token-file-configuration-option.patch new file mode 100644 index 000000000..e3f3de655 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-fix-token-file-configuration-option.patch @@ -0,0 +1,32 @@ +From e2b5305a48a8c5ce5c149437e44d1b82f4b94432 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Mon, 8 May 2023 14:58:06 -0400 +Subject: [PATCH] dbc2val: fix token file configuration option + +The client library changed the token option name to +'token_or_tokenfile', update things to match so that token +location can be configured again for dbcfeeder.py. + +Upstream-Status: pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + dbc2val/dbcfeederlib/serverclientwrapper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dbc2val/dbcfeederlib/serverclientwrapper.py b/dbc2val/dbcfeederlib/serverclientwrapper.py +index 851516b..4f44913 100644 +--- a/dbc2val/dbcfeederlib/serverclientwrapper.py ++++ b/dbc2val/dbcfeederlib/serverclientwrapper.py +@@ -60,7 +60,7 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): + self._client_config["insecure"] = not self._tls + # Do not set token if it is empty to allow default client lib info to be used + if self._token_path != "": +- self._client_config["token"] = self._token_path ++ self._client_config["token_or_tokenfile"] = self._token_path + + # TODO add data for root cert if using TLS and if given + +-- +2.39.2 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini index 7da8381f0..411c7bc47 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini @@ -1,21 +1,26 @@ [general] -# use case: -# switch between databroker and kuksa -# default kuksa -usecase = kuksa +# server type: +# switch between kuksa_databroker and kuksa_val_server +server_type = kuksa_val_server # VSS mapping file -mapping=/etc/kuksa-dbc-feeder/mapping.yml +mapping = /usr/share/vss/vss.json -[kuksa_val] -# kuksa VSS server address -server=wss://localhost:8090 -# JWT security token file -token=/etc/kuksa-dbc-feeder/dbc_feeder.json.token +# IP address for server (KUKSA.val Server or Databroker) +ip = localhost + +# Port for server (KUKSA.val Server or Databroker) +port = 8090 + +# Shall TLS be used (default False for Databroker, True for KUKSA.val Server) +tls = True + +# Token file for authorization. +token = /etc/kuksa-dbc-feeder/dbc_feeder.json.token [can] # CAN port -port=can0 -#Enable SAE-J1939 Mode. False: ignore -j1939=False +port = can0 +# Enable SAE-J1939 Mode. False: ignore +j1939 = False # DBC file used to parse CAN messages -dbcfile=/etc/kuksa-dbc-feeder/agl-vcar.dbc +dbcfile = /etc/kuksa-dbc-feeder/agl-vcar.dbc diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb index b5597d003..5fe872c69 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb @@ -7,23 +7,25 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=175792518e4ac015ab6696d16c4f607e" DEPENDS = "python3-setuptools-git-versioning-native" -PV = "0.1.0+git${SRCPV}" +PV = "0.1.2+git${SRCPV}" 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://0003-dbc2val-fix-token-file-configuration-option.patch \ file://config.ini \ file://dbc_feeder.json.token \ - file://mapping.yml \ file://agl-vcar.dbc \ file://kuksa-dbc-feeder.service \ " -SRCREV = "a857a1d6981b7d62b80ac03e60988a0bded3e255" +SRCREV = "d5fe991706bd8fc6d92ffbbaa838a380067f201f" S = "${WORKDIR}/git" inherit setuptools3 systemd +SETUPTOOLS_SETUP_PATH = "${S}/dbc2val" + SYSTEMD_SERVICE:${PN} = "${BPN}.service" do_install:append() { @@ -33,7 +35,6 @@ do_install:append() { # The potential for running the feeder as non-root will take some # investigation. install -m 0600 ${WORKDIR}/dbc_feeder.json.token ${D}${sysconfdir}/kuksa-dbc-feeder/ - install -m 0644 ${WORKDIR}/mapping.yml ${D}${sysconfdir}/kuksa-dbc-feeder/ install -m 0644 ${WORKDIR}/agl-vcar.dbc ${D}${sysconfdir}/kuksa-dbc-feeder/ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}${systemd_system_unitdir} @@ -51,6 +52,6 @@ RDEPENDS:${PN} += " \ python3-can-j1939 \ python3-pyyaml \ python3-py-expression-eval \ - kuksa-viss-client \ + kuksa-client \ can-dev-helper \ " diff --git a/recipes-connectivity/kuksa-val/kuksa-val-agl-demo-cluster/kuksa-val.env b/recipes-connectivity/kuksa-val/kuksa-val-agl-demo-cluster/kuksa-val.env index e6778a3d9..f5ea757ef 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val-agl-demo-cluster/kuksa-val.env +++ b/recipes-connectivity/kuksa-val/kuksa-val-agl-demo-cluster/kuksa-val.env @@ -1 +1 @@ -EXTRA_ARGS="--overlays /usr/share/kuksa-val/overlays --address 0.0.0.0" +EXTRA_ARGS="--vss /usr/share/vss/vss.json --address 0.0.0.0" diff --git a/recipes-connectivity/kuksa-val/kuksa-val-agl.bb b/recipes-connectivity/kuksa-val/kuksa-val-agl.bb index 1614c5fbd..91c5dc932 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val-agl.bb +++ b/recipes-connectivity/kuksa-val/kuksa-val-agl.bb @@ -5,17 +5,13 @@ BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -SRC_URI = "file://00-agl_vss_overlay_2.2.json \ - file://kuksa-val.env \ -" +SRC_URI = "file://kuksa-val.env" inherit allarch update-alternatives do_install() { install -d ${D}${sysconfdir}/default install -m 0644 ${WORKDIR}/kuksa-val.env ${D}${sysconfdir}/default/kuksa-val.agl - install -d ${D}${datadir}/kuksa-val/overlays - install -m 0644 ${WORKDIR}/00-agl_vss_overlay_2.2.json ${D}${datadir}/kuksa-val/overlays/ } FILES:${PN} += "${datadir}/kuksa-val/overlays" diff --git a/recipes-connectivity/kuksa-val/kuksa-val-agl/kuksa-val.env b/recipes-connectivity/kuksa-val/kuksa-val-agl/kuksa-val.env index 74a5f4e4d..c7cffb387 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val-agl/kuksa-val.env +++ b/recipes-connectivity/kuksa-val/kuksa-val-agl/kuksa-val.env @@ -1 +1 @@ -EXTRA_ARGS="--overlays /usr/share/kuksa-val/overlays" +EXTRA_ARGS="--vss /usr/share/vss/vss.json" diff --git a/recipes-connectivity/kuksa-val/kuksa-val.inc b/recipes-connectivity/kuksa-val/kuksa-val.inc index 6d9a5cc04..f9369ae4d 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val.inc +++ b/recipes-connectivity/kuksa-val/kuksa-val.inc @@ -1,6 +1,6 @@ -PV = "0.2.5+git${SRCPV}" +PV = "0.3.1+git${SRCPV}" SRC_URI = "gitsm://github.com/eclipse/kuksa.val.git;protocol=https;branch=master" -SRCREV = "590198a35de7b2201bdd913750157bb9778a5214" +SRCREV = "b57466bb2363e985cd7ea755aed4d0e98d6dacac" S = "${WORKDIR}/git" 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 8375d07a3..b4e918544 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,6 +1,6 @@ -From b9df9bcf058e072e4c67dc8cc6ab41c3db745cbf Mon Sep 17 00:00:00 2001 +From 8e3039af3fc2badb24ff5df9f60c8d5964d2389e Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Thu, 6 Oct 2022 15:42:51 -0400 +Date: Wed, 5 Apr 2023 16:05:52 -0400 Subject: [PATCH] Make install locations configurable Make binary, certificate, and configuration file install locations @@ -17,21 +17,21 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- 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(-) + kuksa-val-server/src/CMakeLists.txt | 57 ++++++++++++++++++++++------- + kuksa-val-server/src/config.hpp.in | 27 ++++++++++++++ + kuksa-val-server/src/main.cpp | 5 ++- + 5 files changed, 80 insertions(+), 23 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/kuksa-val-server/config.ini b/kuksa-val-server/config.ini deleted file mode 100644 -index 34326aa..0000000 +index 3e4ada4..0000000 --- a/kuksa-val-server/config.ini +++ /dev/null @@ -1,7 +0,0 @@ --vss = vss_release_3.0.json +-vss = vss_release_3.1.1.json -log-level = ALL -cert-path = . - @@ -40,11 +40,11 @@ index 34326aa..0000000 - topic-prefix = vss diff --git a/kuksa-val-server/config.ini.in b/kuksa-val-server/config.ini.in new file mode 100644 -index 0000000..3d888e5 +index 0000000..153f355 --- /dev/null +++ b/kuksa-val-server/config.ini.in @@ -0,0 +1,7 @@ -+vss = @KUKSA_DEFAULT_DATADIR@/vss_release_3.0.json ++vss = @KUKSA_DEFAULT_DATADIR@/vss_release_3.1.1.json +log-level = ALL +cert-path = @KUKSA_DEFAULT_CERTDIR@ + @@ -52,10 +52,10 @@ index 0000000..3d888e5 + publish = + topic-prefix = vss diff --git a/kuksa-val-server/src/CMakeLists.txt b/kuksa-val-server/src/CMakeLists.txt -index ea75ef7..e791a13 100644 +index d73462c..33518de 100644 --- a/kuksa-val-server/src/CMakeLists.txt +++ b/kuksa-val-server/src/CMakeLists.txt -@@ -161,6 +161,35 @@ if(BUILD_EXE) +@@ -162,6 +162,35 @@ if(BUILD_EXE) ###### # Setup server install and packaging @@ -91,10 +91,10 @@ index ea75ef7..e791a13 100644 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) +@@ -173,22 +202,22 @@ if(BUILD_EXE) 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}/../../data/vss-core/vss_release_3.1.1.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) @@ -110,6 +110,8 @@ index ea75ef7..e791a13 100644 - 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( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../data/vss-core/vss_release_3.1.1.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}) @@ -121,10 +123,11 @@ index ea75ef7..e791a13 100644 + 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_SOURCE_DIR}/../../data/vss-core/vss_release_3.1.1.json DESTINATION ${KUKSA_INSTALL_DATADIR}) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.ini DESTINATION ${KUKSA_INSTALL_CONFIGDIR}) - # CPack + INCLUDE(InstallRequiredSystemLibraries) diff --git a/kuksa-val-server/src/config.hpp.in b/kuksa-val-server/src/config.hpp.in new file mode 100644 index 0000000..24226d2 @@ -159,7 +162,7 @@ index 0000000..24226d2 + +#endif diff --git a/kuksa-val-server/src/main.cpp b/kuksa-val-server/src/main.cpp -index 234171a..2f7011a 100644 +index b085126..9c7f8ae 100644 --- a/kuksa-val-server/src/main.cpp +++ b/kuksa-val-server/src/main.cpp @@ -47,6 +47,7 @@ @@ -181,7 +184,7 @@ index 234171a..2f7011a 100644 "Sample of configuration file parameters looks like:\n" @@ -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_3.0.json' file can be found under [data](./data/vss-core/vss_release_3.0.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.1.1.json' file can be found under [data](./data/vss-core/vss_release_3.1.1.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)), @@ -189,5 +192,5 @@ index 234171a..2f7011a 100644 ("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.37.3 +2.39.2 diff --git a/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-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 deleted file mode 100644 index acd416911..000000000 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client/0001-kuksa_viss_client-Update-cmd2-completer-usage.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 1da7b980d05706c8d4e9bcb0d12965258a4fc709 Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -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 | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -diff --git a/kuksa_viss_client/__main__.py b/kuksa_viss_client/__main__.py -index 5e595f8..e5798b8 100755 ---- a/kuksa_viss_client/__main__.py -+++ b/kuksa_viss_client/__main__.py -@@ -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 -+from cmd2.exceptions import CompletionError - import functools, subprocess - DEFAULT_SERVER_ADDR = "127.0.0.1" - DEFAULT_SERVER_PORT = 8090 -@@ -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): - 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)) -- return basic_complete(text, line, begidx, endidx, self.pathCompletionItems) -+ return Cmd.basic_complete(self, text, line, begidx, endidx, self.pathCompletionItems) - - COMM_SETUP_COMMANDS = "Communication Set-up Commands" - VISS_COMMANDS = "Kuksa Interaction Commands" -@@ -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"))) -- ap_authorize.add_argument('Token', help='JWT(or the file storing the token) for authorizing the client.', completer_method=tokenfile_completer_method) -+ 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 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("-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("-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) -+ ap_setTargetValue.add_argument("Path", help="Path whose target value to be set", completer=path_completer) - ap_setTargetValue.add_argument("Value", help="Value to be set") - - ap_getTargetValue = argparse.ArgumentParser() -- ap_getTargetValue.add_argument("Path", help="Path whose target value to be read", completer_method=path_completer) -+ ap_getTargetValue.add_argument("Path", help="Path whose target value to be read", completer=path_completer) - - ap_subscribe = argparse.ArgumentParser() -- ap_subscribe.add_argument("Path", help="Path to be subscribed", completer_method=path_completer) -+ ap_subscribe.add_argument("Path", help="Path to be subscribed", completer=path_completer) - 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) -+ ap_unsubscribe.add_argument("SubscribeId", help="Corresponding subscription Id", completer=subscriptionIdCompleter) - - ap_getMetaData = argparse.ArgumentParser() -- ap_getMetaData.add_argument("Path", help="Path whose metadata is to be read", completer_method=path_completer) -+ ap_getMetaData.add_argument("Path", help="Path whose metadata is to be read", completer=path_completer) - ap_updateMetaData = argparse.ArgumentParser() -- ap_updateMetaData.add_argument("Path", help="Path whose MetaData is to update", completer_method=path_completer) -+ ap_updateMetaData.add_argument("Path", help="Path whose MetaData is to update", completer=path_completer) - ap_updateMetaData.add_argument("Json", help="MetaData to update. Note, only attributes can be update, if update children or the whole vss tree, use `updateVSSTree` instead.") - - ap_updateVSSTree = argparse.ArgumentParser() - jsonfile_completer_method = functools.partial(Cmd.path_complete, - path_filter=lambda path: (os.path.isdir(path) or path.endswith(".json"))) -- 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/0002-kuksa_viss_client-Add-external-certificates-support.patch b/recipes-connectivity/kuksa-val/kuksa-viss-client/0002-kuksa_viss_client-Add-external-certificates-support.patch deleted file mode 100644 index 7ad5ac182..000000000 --- a/recipes-connectivity/kuksa-val/kuksa-viss-client/0002-kuksa_viss_client-Add-external-certificates-support.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 101550383386f465e689aa846826b58aa72cf793 Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 24 Apr 2023 15:49:32 -0400 -Subject: [PATCH] kuksa_viss_client: Add external certificates support - -Tweak the definition of __certificate_dir__ in the kuksa_certificates -package, and certificate location logic in the client library to allow -picking up alternative certificates from /etc/kuksa-certificates or -/etc/kuksa-val before falling back to the shipped defaults. The -intent is to allow packagers to more straighhtforwardly use their own -certificates with both the server and clients. - -Upstream-Status: pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - kuksa_certificates/__init__.py | 7 ++++++- - kuksa_viss_client/KuksaGrpcComm.py | 10 +++++----- - kuksa_viss_client/KuksaWsComm.py | 10 +++++----- - 3 files changed, 16 insertions(+), 11 deletions(-) - -diff --git a/kuksa_certificates/__init__.py b/kuksa_certificates/__init__.py -index 5f05b75..ac60bc3 100644 ---- a/kuksa_certificates/__init__.py -+++ b/kuksa_certificates/__init__.py -@@ -2,4 +2,9 @@ import os - - from kuksa_viss_client._metadata import * - --__certificate_dir__= os.path.dirname(os.path.realpath(__file__)) -+if os.path.isdir("/etc/kuksa-certificates"): -+ __certificate_dir__= "/etc/kuksa-certificates" -+elif os.path.isdir("/etc/kuksa-val"): -+ __certificate_dir__= "/etc/kuksa-val" -+else: -+ __certificate_dir__= os.path.dirname(os.path.realpath(__file__)) -diff --git a/kuksa_viss_client/KuksaGrpcComm.py b/kuksa_viss_client/KuksaGrpcComm.py -index 1f55754..e425e7e 100644 ---- a/kuksa_viss_client/KuksaGrpcComm.py -+++ b/kuksa_viss_client/KuksaGrpcComm.py -@@ -28,22 +28,22 @@ import uuid, time, threading - - from . import kuksa_pb2 - from . import kuksa_pb2_grpc -+from kuksa_certificates import __certificate_dir__ - - class KuksaGrpcComm: - - # Constructor - def __init__(self, config): -- scriptDir= os.path.dirname(os.path.realpath(__file__)) - self.serverIP = config.get('ip', "127.0.0.1") - self.serverPort = config.get('port', 8090) - try: - self.insecure = config.getboolean('insecure', False) - except AttributeError: - self.insecure = config.get('insecure', False) -- self.cacertificate = config.get('cacertificate', os.path.join(scriptDir, "../kuksa_certificates/CA.pem")) -- self.certificate = config.get('certificate', os.path.join(scriptDir, "../kuksa_certificates/Client.pem")) -- self.keyfile = config.get('key', os.path.join(scriptDir, "../kuksa_certificates/Client.key")) -- self.tokenfile = config.get('token', os.path.join(scriptDir, "../kuksa_certificates/jwt/all-read-write.json.token")) -+ self.cacertificate = config.get('cacertificate', os.path.join(__certificate_dir__, "CA.pem")) -+ self.certificate = config.get('certificate', os.path.join(__certificate_dir__, "Client.pem")) -+ self.keyfile = config.get('key', os.path.join(__certificate_dir__, "Client.key")) -+ self.tokenfile = config.get('token', os.path.join(__certificate_dir__, "jwt/all-read-write.json.token")) - self.grpcConnected = False - - self.subscriptionCallbacks = {} -diff --git a/kuksa_viss_client/KuksaWsComm.py b/kuksa_viss_client/KuksaWsComm.py -index b0d4cc1..b85b573 100644 ---- a/kuksa_viss_client/KuksaWsComm.py -+++ b/kuksa_viss_client/KuksaWsComm.py -@@ -20,22 +20,22 @@ - - import json, queue, time, uuid, os, ssl - import asyncio, websockets -+from kuksa_certificates import __certificate_dir__ - - class KuksaWsComm: - - # Constructor - def __init__(self, config): - -- scriptDir= os.path.dirname(os.path.realpath(__file__)) - self.serverIP = config.get('ip', "127.0.0.1") - self.serverPort = config.get('port', 8090) - try: - self.insecure = config.getboolean('insecure', False) - except AttributeError: - self.insecure = config.get('insecure', False) -- self.cacertificate = config.get('cacertificate', os.path.join(scriptDir, "../kuksa_certificates/CA.pem")) -- self.certificate = config.get('certificate', os.path.join(scriptDir, "../kuksa_certificates/Client.pem")) -- self.keyfile = config.get('key', os.path.join(scriptDir, "../kuksa_certificates/Client.key")) -+ self.cacertificate = config.get('cacertificate', os.path.join(__certificate_dir__, "CA.pem")) -+ self.certificate = config.get('certificate', os.path.join(__certificate_dir__, "Client.pem")) -+ self.keyfile = config.get('key', os.path.join(__certificate_dir__, "Client.key")) - self.wsConnected = False - - self.subscriptionCallbacks = {} -@@ -254,4 +254,4 @@ class KuksaWsComm: - await self._msgHandler(ws) - except OSError as e: - print("Disconnected!! " + str(e)) -- pass -\ No newline at end of file -+ pass --- -2.39.2 - diff --git a/recipes-platform/packagegroups/packagegroup-agl-ivi-services.bb b/recipes-platform/packagegroups/packagegroup-agl-ivi-services.bb index 0b1cf5765..49cd8a456 100644 --- a/recipes-platform/packagegroups/packagegroup-agl-ivi-services.bb +++ b/recipes-platform/packagegroups/packagegroup-agl-ivi-services.bb @@ -9,6 +9,7 @@ PACKAGES = "\ RDEPENDS:${PN} += "\ kuksa-val \ + vss-agl \ kuksa-val-agl \ kuksa-certificates-agl \ kuksa-dbc-feeder \ |