From efd8d2fc45352b3074086b984f89c89c4ab6263f Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 10 Sep 2024 09:27:10 +0200 Subject: [PATCH] introduce OID attributes OID stands for "Object ID" and is meant to be a UUID for objects, i.e. it is supposed to be an invariant globally unique identifier for objects. It can e.g., be used to locate objects in an ODX editor across projects, but there is no formal mechanism to reference an object via its OID within the ODX data model. Signed-off-by: Andreas Lauser Signed-off-by: Gerrit Ecke --- examples/mksomersaultmodifiedpdx.py | 6 + examples/somersaultecu.py | 118 ++++++++++++++++- odxtools/element.py | 21 ++- odxtools/outputparam.py | 4 +- odxtools/parameters/parameter.py | 3 + odxtools/physicaldimension.py | 5 +- .../templates/macros/printAudience.xml.jinja2 | 2 +- .../macros/printCompanyData.xml.jinja2 | 4 +- .../templates/macros/printComparam.xml.jinja2 | 4 +- odxtools/templates/macros/printDOP.xml.jinja2 | 2 +- .../templates/macros/printDiagComm.xml.jinja2 | 2 +- .../macros/printDiagLayer.xml.jinja2 | 2 +- .../macros/printDiagVariable.xml.jinja2 | 6 +- .../printDynamicEndmarkerField.xml.jinja2 | 2 +- .../macros/printDynamicLengthField.xml.jinja2 | 2 +- .../macros/printElementId.xml.jinja2 | 5 + .../templates/macros/printEndOfPdu.xml.jinja2 | 2 +- .../macros/printEnvDataDesc.xml.jinja2 | 2 +- .../macros/printFunctionalClass.xml.jinja2 | 2 +- odxtools/templates/macros/printMux.xml.jinja2 | 2 +- .../templates/macros/printParam.xml.jinja2 | 4 +- .../macros/printProtStack.xml.jinja2 | 2 +- .../templates/macros/printRequest.xml.jinja2 | 2 +- .../templates/macros/printResponse.xml.jinja2 | 2 +- .../macros/printSingleEcuJob.xml.jinja2 | 2 +- .../macros/printSpecialData.xml.jinja2 | 2 +- .../templates/macros/printState.xml.jinja2 | 2 +- .../macros/printStateChart.xml.jinja2 | 2 +- .../macros/printStateTransition.xml.jinja2 | 2 +- .../macros/printStaticField.xml.jinja2 | 2 +- .../macros/printStructure.xml.jinja2 | 2 +- .../templates/macros/printTable.xml.jinja2 | 4 +- .../templates/macros/printUnitSpec.xml.jinja2 | 8 +- odxtools/unit.py | 4 +- odxtools/writepdxfile.py | 1 + tests/test_decoding.py | 120 ++++++++++++++++++ tests/test_diag_coded_types.py | 20 +++ tests/test_diag_data_dictionary_spec.py | 18 +++ tests/test_ecu_variant_matching.py | 8 ++ tests/test_encoding.py | 43 +++++++ tests/test_singleecujob.py | 9 ++ tests/test_unit_spec.py | 5 + 42 files changed, 400 insertions(+), 60 deletions(-) diff --git a/examples/mksomersaultmodifiedpdx.py b/examples/mksomersaultmodifiedpdx.py index 91b4c4b1..704c2489 100755 --- a/examples/mksomersaultmodifiedpdx.py +++ b/examples/mksomersaultmodifiedpdx.py @@ -101,6 +101,7 @@ def find_named_object(item_list: List[T], name: str) -> T: # add a new "flic-flac" service flic_flac_request = Request( odx_id=OdxLinkId("somersault.RQ.flic_flac", doc_frags), + oid=None, short_name="RQ_flic_flac", long_name=None, description=None, @@ -108,6 +109,7 @@ def find_named_object(item_list: List[T], name: str) -> T: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -125,6 +127,7 @@ def find_named_object(item_list: List[T], name: str) -> T: flic_flac_positive_response = Response( odx_id=OdxLinkId("somersault.PR.flic_flac", doc_frags), + oid=None, short_name="PR_flic_flac", long_name=None, description=None, @@ -133,6 +136,7 @@ def find_named_object(item_list: List[T], name: str) -> T: response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -144,6 +148,7 @@ def find_named_object(item_list: List[T], name: str) -> T: sdgs=[], ), ValueParameter( + oid=None, short_name="can_do_backward_flips", long_name=None, semantic=None, @@ -162,6 +167,7 @@ def find_named_object(item_list: List[T], name: str) -> T: flic_flac_service = DiagService( odx_id=OdxLinkId("somersault.service.flic_flac", doc_frags), + oid=None, short_name="flic_flac", long_name=None, description=None, diff --git a/examples/somersaultecu.py b/examples/somersaultecu.py index bff9f906..7bca9cb4 100755 --- a/examples/somersaultecu.py +++ b/examples/somersaultecu.py @@ -105,6 +105,7 @@ class SomersaultSID(IntEnum): "doggy": TeamMember( odx_id=OdxLinkId("TM.Doggy", doc_frags), + oid=None, short_name="Doggy", long_name="Doggy the dog", description=Description.from_string("

Dog is man's best friend

"), @@ -120,6 +121,7 @@ class SomersaultSID(IntEnum): "horsey": TeamMember( odx_id=OdxLinkId("TM.Horsey", doc_frags), + oid=None, short_name="Horsey", long_name="Horsey the horse", description=Description.from_string("

Trustworthy worker

"), @@ -135,6 +137,7 @@ class SomersaultSID(IntEnum): "slothy": TeamMember( odx_id=OdxLinkId("TM.Slothy", doc_frags), + oid=None, short_name="Slothy", long_name=None, description=None, @@ -153,6 +156,7 @@ class SomersaultSID(IntEnum): "suncus": CompanyData( odx_id=OdxLinkId("CD.Suncus", doc_frags), + oid=None, short_name="Suncus", long_name="Circus of the sun", description=Description.from_string("

Prestigious group of performers

"), @@ -184,6 +188,7 @@ class SomersaultSID(IntEnum): "acme": CompanyData( odx_id=OdxLinkId("CD.ACME", doc_frags), + oid=None, short_name="ACME_Corporation", long_name=None, description=None, @@ -250,6 +255,7 @@ class SomersaultSID(IntEnum): "flip": FunctionalClass( odx_id=OdxLinkId("somersault.FNC.flip", doc_frags), + oid=None, short_name="flip", long_name="Flip", description=None, @@ -257,6 +263,7 @@ class SomersaultSID(IntEnum): "session": FunctionalClass( odx_id=OdxLinkId("somersault.FNC.session", doc_frags), + oid=None, short_name="session", long_name="Session", description=None, @@ -268,6 +275,7 @@ class SomersaultSID(IntEnum): "attentive_admirer": AdditionalAudience( odx_id=OdxLinkId("somersault.AA.attentive_admirer", doc_frags), + oid=None, short_name="attentive_admirer", long_name="Attentive Admirer", description=None, @@ -275,6 +283,7 @@ class SomersaultSID(IntEnum): "anyone": AdditionalAudience( odx_id=OdxLinkId("somersault.AA.anyone", doc_frags), + oid=None, short_name="anyone", long_name="Anyone", description=None, @@ -325,6 +334,7 @@ class SomersaultSID(IntEnum): "time": PhysicalDimension( odx_id=OdxLinkId("somersault.PD.time", doc_frags), + oid=None, short_name="time", long_name="Time", time_exp=1, @@ -334,12 +344,12 @@ class SomersaultSID(IntEnum): temperature_exp=0, molar_amount_exp=0, luminous_intensity_exp=0, - oid=None, description=None, ), "temperature": PhysicalDimension( odx_id=OdxLinkId("somersault.PD.temperature", doc_frags), + oid=None, short_name="temperature", long_name="Temperature", time_exp=0, @@ -349,7 +359,6 @@ class SomersaultSID(IntEnum): temperature_exp=1, molar_amount_exp=0, luminous_intensity_exp=0, - oid=None, description=None, ) } @@ -471,6 +480,7 @@ class SomersaultSID(IntEnum): "num_flips": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.num_flips", doc_frags), + oid=None, short_name="num_flips", long_name=None, description=None, @@ -486,6 +496,7 @@ class SomersaultSID(IntEnum): "soberness_check": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.soberness_check", doc_frags), + oid=None, short_name="soberness_check", long_name=None, description=None, @@ -501,6 +512,7 @@ class SomersaultSID(IntEnum): "dizzyness_level": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.dizzyness_level", doc_frags), + oid=None, short_name="dizzyness_level", long_name=None, description=None, @@ -516,6 +528,7 @@ class SomersaultSID(IntEnum): "happiness_level": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.happiness_level", doc_frags), + oid=None, short_name="happiness_level", long_name=None, description=None, @@ -531,6 +544,7 @@ class SomersaultSID(IntEnum): "duration": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.duration", doc_frags), + oid=None, short_name="duration", long_name=None, description=None, @@ -546,6 +560,7 @@ class SomersaultSID(IntEnum): "temperature": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.temperature", doc_frags), + oid=None, short_name="temperature", long_name=None, description=None, @@ -561,6 +576,7 @@ class SomersaultSID(IntEnum): "error_code": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.error_code", doc_frags), + oid=None, short_name="error_code", long_name=None, description=None, @@ -576,6 +592,7 @@ class SomersaultSID(IntEnum): "boolean": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.boolean", doc_frags), + oid=None, short_name="boolean", long_name=None, description=None, @@ -592,6 +609,7 @@ class SomersaultSID(IntEnum): "uint8": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.uint8", doc_frags), + oid=None, short_name="uint8", long_name=None, description=None, @@ -607,6 +625,7 @@ class SomersaultSID(IntEnum): "uint16": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.uint16", doc_frags), + oid=None, short_name="uint16", long_name=None, description=None, @@ -622,6 +641,7 @@ class SomersaultSID(IntEnum): "float": DataObjectProperty( odx_id=OdxLinkId("somersault.DOP.float", doc_frags), + oid=None, short_name="float", long_name=None, description=None, @@ -644,6 +664,7 @@ class SomersaultSID(IntEnum): "session": Response( odx_id=OdxLinkId("somersault.PR.session_start", doc_frags), + oid=None, short_name="session", long_name=None, description=None, @@ -652,6 +673,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -664,6 +686,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="can_do_backward_flips", long_name=None, semantic=None, @@ -681,6 +704,7 @@ class SomersaultSID(IntEnum): "tester_ok": Response( odx_id=OdxLinkId("somersault.PR.tester_present", doc_frags), + oid=None, short_name="tester_present", long_name=None, description=None, @@ -689,6 +713,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -701,6 +726,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="status", long_name=None, semantic=None, @@ -718,6 +744,7 @@ class SomersaultSID(IntEnum): "forward_flips_grudgingly_done": Response( odx_id=OdxLinkId("somersault.PR.grudging_forward", doc_frags), + oid=None, short_name="grudging_forward", long_name=None, description=None, @@ -726,6 +753,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -739,6 +767,7 @@ class SomersaultSID(IntEnum): ), # TODO (?): non-byte aligned MatchingRequestParameters MatchingRequestParameter( + oid=None, short_name="num_flips_done", long_name=None, semantic=None, @@ -750,6 +779,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="sault_time", long_name=None, semantic=None, @@ -767,6 +797,7 @@ class SomersaultSID(IntEnum): "forward_flips_happily_done": Response( odx_id=OdxLinkId("somersault.PR.happy_forward", doc_frags), + oid=None, short_name="happy_forward", long_name=None, description=None, @@ -775,6 +806,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -788,6 +820,7 @@ class SomersaultSID(IntEnum): ), # TODO (?): non-byte aligned MatchingRequestParameters MatchingRequestParameter( + oid=None, short_name="num_flips_done", long_name=None, semantic=None, @@ -799,6 +832,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="yeha_level", long_name=None, semantic=None, @@ -816,6 +850,7 @@ class SomersaultSID(IntEnum): "backward_flips_grudgingly_done": Response( odx_id=OdxLinkId("somersault.PR.grudging_backward", doc_frags), + oid=None, short_name="grudging_backward", long_name=None, description=None, @@ -824,6 +859,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -836,6 +872,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="num_flips_done", long_name=None, semantic=None, @@ -848,6 +885,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="grumpiness_level", long_name=None, semantic=None, @@ -866,6 +904,7 @@ class SomersaultSID(IntEnum): "status_report": Response( odx_id=OdxLinkId("somersault.PR.status_report", doc_frags), + oid=None, short_name="status_report", long_name=None, description=None, @@ -874,6 +913,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -886,6 +926,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="dizzyness_level", long_name=None, semantic=None, @@ -898,6 +939,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="happiness_level", long_name=None, semantic=None, @@ -910,6 +952,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), TableKeyParameter( + oid=None, odx_id=OdxLinkId("somersault.PR.report_status.last_pos_response_key", doc_frags), short_name="last_pos_response_key", @@ -925,6 +968,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), TableStructParameter( + oid=None, short_name="last_pos_response", long_name=None, semantic=None, @@ -942,6 +986,7 @@ class SomersaultSID(IntEnum): "set_operation_params": Response( odx_id=OdxLinkId("somersault.PR.set_operation_params", doc_frags), + oid=None, short_name="set_operation_params", long_name=None, description=None, @@ -950,6 +995,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -982,6 +1028,7 @@ class SomersaultSID(IntEnum): "general": Response( odx_id=OdxLinkId("somersault.NR.general_negative_response", doc_frags), + oid=None, short_name="general_negative_response", long_name=None, description=None, @@ -990,6 +1037,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.NEGATIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1001,6 +1049,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), MatchingRequestParameter( + oid=None, short_name="rq_sid", long_name=None, semantic=None, @@ -1012,6 +1061,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="response_code", long_name=None, semantic=None, @@ -1032,6 +1082,7 @@ class SomersaultSID(IntEnum): "tester_nok": Response( odx_id=OdxLinkId("somersault.NR.tester_nok", doc_frags), + oid=None, short_name="tester_nok", long_name=None, description=None, @@ -1040,6 +1091,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.NEGATIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1051,6 +1103,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="rq_sid", long_name=None, semantic=None, @@ -1067,6 +1120,7 @@ class SomersaultSID(IntEnum): "flips_not_done": Response( odx_id=OdxLinkId("somersault.NR.flips_not_done", doc_frags), + oid=None, short_name="flips_not_done", long_name=None, description=None, @@ -1075,6 +1129,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.NEGATIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1086,6 +1141,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), MatchingRequestParameter( + oid=None, short_name="rq_sid", long_name=None, semantic=None, @@ -1097,6 +1153,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), NrcConstParameter( + oid=None, short_name="reason", long_name=None, semantic=None, @@ -1112,6 +1169,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="flips_successfully_done", long_name=None, semantic=None, @@ -1132,6 +1190,7 @@ class SomersaultSID(IntEnum): "general": Response( odx_id=OdxLinkId("GNR.too_hot", doc_frags), + oid=None, short_name="too_hot", long_name=None, description=None, @@ -1140,6 +1199,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.GLOBAL_NEGATIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1151,6 +1211,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="too_hot_dummy", long_name=None, semantic=None, @@ -1162,6 +1223,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="too_hot_id", long_name=None, semantic=None, @@ -1173,6 +1235,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="temperature", long_name=None, semantic=None, @@ -1196,6 +1259,7 @@ class SomersaultSID(IntEnum): "last_flip_details": Table( odx_id=last_flip_details_table_id, + oid=None, short_name="last_flip_details", long_name="Flip Details", description=Description.from_string( @@ -1209,6 +1273,7 @@ class SomersaultSID(IntEnum): TableRow( table_ref=last_flip_details_table_ref, odx_id=OdxLinkId("somersault.table.last_flip_details.none", doc_frags), + oid=None, short_name="none", long_name="No Flips Done Yet", key_raw="0", @@ -1224,6 +1289,7 @@ class SomersaultSID(IntEnum): table_ref=last_flip_details_table_ref, odx_id=OdxLinkId("somersault.table.last_flip_details.forward_grudging", doc_frags), + oid=None, short_name="forward_grudging", long_name="Forward Flips Grudgingly Done", key_raw="3", @@ -1240,6 +1306,7 @@ class SomersaultSID(IntEnum): TableRow( table_ref=last_flip_details_table_ref, odx_id=OdxLinkId("somersault.table.last_flip_details.forward_happy", doc_frags), + oid=None, short_name="forward_happily", long_name="Forward Flips Happily Done", description=None, @@ -1255,6 +1322,7 @@ class SomersaultSID(IntEnum): TableRow( table_ref=last_flip_details_table_ref, odx_id=OdxLinkId("somersault.table.last_flip_details.backward", doc_frags), + oid=None, short_name="backward_grudging", long_name="Backward Flips", description=None, @@ -1277,6 +1345,7 @@ class SomersaultSID(IntEnum): "start_session": Request( odx_id=OdxLinkId("somersault.RQ.start_session", doc_frags), + oid=None, short_name="start_session", long_name="Start the diagnostic session & do some mischief", description=None, @@ -1284,6 +1353,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1296,6 +1366,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="id", long_name=None, semantic=None, @@ -1312,6 +1383,7 @@ class SomersaultSID(IntEnum): "stop_session": Request( odx_id=OdxLinkId("somersault.RQ.stop_session", doc_frags), + oid=None, short_name="stop_session", long_name="Terminate the current diagnostic session", description=None, @@ -1319,6 +1391,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1331,6 +1404,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="id", long_name=None, semantic=None, @@ -1347,6 +1421,7 @@ class SomersaultSID(IntEnum): "tester_present": Request( odx_id=OdxLinkId("somersault.RQ.tester_present", doc_frags), + oid=None, short_name="tester_present", long_name="Prevent the current diagnostic session from timing out", description=None, @@ -1354,6 +1429,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1365,6 +1441,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="id", long_name=None, semantic=None, @@ -1381,6 +1458,7 @@ class SomersaultSID(IntEnum): "set_operation_params": Request( odx_id=OdxLinkId("somersault.RQ.set_operation_params", doc_frags), + oid=None, short_name="set_operation_params", long_name="Specify the mode of operation for the ECU; e.g. if rings " "of fire ought to be used for maximum effect", @@ -1389,6 +1467,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1401,6 +1480,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="use_fire_ring", long_name=None, semantic=None, @@ -1418,6 +1498,7 @@ class SomersaultSID(IntEnum): "forward_flips": Request( odx_id=OdxLinkId("somersault.RQ.do_forward_flips", doc_frags), + oid=None, short_name="do_forward_flips", long_name="Do forward somersaults & some other mischief", description=None, @@ -1425,6 +1506,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1436,6 +1518,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="forward_soberness_check", long_name=None, semantic=None, @@ -1449,6 +1532,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="num_flips", long_name=None, semantic=None, @@ -1466,6 +1550,7 @@ class SomersaultSID(IntEnum): "backward_flips": Request( odx_id=OdxLinkId("somersault.RQ.do_backward_flips", doc_frags), + oid=None, short_name="do_backward_flips", long_name="Do a backward somersault & some other mischief", description=None, @@ -1473,6 +1558,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1484,6 +1570,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="backward_soberness_check", long_name=None, semantic=None, @@ -1497,6 +1584,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="num_flips", long_name=None, semantic=None, @@ -1514,6 +1602,7 @@ class SomersaultSID(IntEnum): "report_status": Request( odx_id=OdxLinkId("somersault.RQ.report_status", doc_frags), + oid=None, short_name="report_status", long_name="Report back the current level of dizzy- & happiness.", description=None, @@ -1521,6 +1610,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=[ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -1533,6 +1623,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), CodedConstParameter( + oid=None, short_name="id", long_name=None, semantic=None, @@ -1553,6 +1644,7 @@ class SomersaultSID(IntEnum): "start_session": DiagService( odx_id=OdxLinkId("somersault.service.session_start", doc_frags), + oid=None, short_name="session_start", long_name=None, description=None, @@ -1587,6 +1679,7 @@ class SomersaultSID(IntEnum): "stop_session": DiagService( odx_id=OdxLinkId("somersault.service.session_stop", doc_frags), + oid=None, short_name="session_stop", long_name=None, description=None, @@ -1621,6 +1714,7 @@ class SomersaultSID(IntEnum): "tester_present": DiagService( odx_id=OdxLinkId("somersault.service.tester_present", doc_frags), + oid=None, short_name="tester_present", long_name=None, description=None, @@ -1664,6 +1758,7 @@ class SomersaultSID(IntEnum): "set_operation_params": DiagService( odx_id=OdxLinkId("somersault.service.set_operation_params", doc_frags), + oid=None, short_name="set_operation_params", long_name=None, description=None, @@ -1696,6 +1791,7 @@ class SomersaultSID(IntEnum): "forward_flips": DiagService( odx_id=OdxLinkId("somersault.service.do_forward_flips", doc_frags), + oid=None, short_name="do_forward_flips", long_name=None, description=Description.from_string("

Do a forward flip.

"), @@ -1747,6 +1843,7 @@ class SomersaultSID(IntEnum): "backward_flips": DiagService( odx_id=OdxLinkId("somersault.service.do_backward_flips", doc_frags), + oid=None, short_name="do_backward_flips", long_name=None, description=None, @@ -1792,6 +1889,7 @@ class SomersaultSID(IntEnum): "report_status": DiagService( odx_id=OdxLinkId("somersault.service.report_status", doc_frags), + oid=None, short_name="report_status", long_name=None, description=None, @@ -1838,6 +1936,7 @@ class SomersaultSID(IntEnum): SingleEcuJob( audience=None, odx_id=OdxLinkId("somersault.service.compulsory_program", doc_frags), + oid=None, short_name="compulsory_program", long_name="Compulsory Program", description=Description.from_string("

Do several fancy moves.

"), @@ -2021,6 +2120,7 @@ class SomersaultSID(IntEnum): somersault_protocol_raw = ProtocolRaw( variant_type=DiagLayerType.PROTOCOL, odx_id=OdxLinkId("somersault.protocol", doc_frags), + oid=None, short_name="somersault_protocol", long_name="Somersault protocol info", description=Description.from_string( @@ -2050,6 +2150,7 @@ class SomersaultSID(IntEnum): somersault_base_variant_raw = BaseVariantRaw( variant_type=DiagLayerType.BASE_VARIANT, odx_id=OdxLinkId("somersault", doc_frags), + oid=None, short_name="somersault", long_name="Somersault base variant", description=Description.from_string("

Base variant of the somersault ECU & cetera

"), @@ -2089,6 +2190,7 @@ class SomersaultSID(IntEnum): somersault_lazy_ecu_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("somersault_lazy", doc_frags), + oid=None, short_name="somersault_lazy", long_name="Somersault lazy ECU", description=Description.from_string( @@ -2139,6 +2241,7 @@ class SomersaultSID(IntEnum): "headstand": Request( odx_id=OdxLinkId("somersault_assiduous.RQ.do_headstand", doc_frags), + oid=None, short_name="do_headstand", long_name="Do a headstand & whatever else is required to entertain the customer", description=None, @@ -2146,6 +2249,7 @@ class SomersaultSID(IntEnum): sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -2157,6 +2261,7 @@ class SomersaultSID(IntEnum): sdgs=[], ), ValueParameter( + oid=None, short_name="duration", long_name=None, semantic=None, @@ -2178,6 +2283,7 @@ class SomersaultSID(IntEnum): "headstand_done": Response( odx_id=OdxLinkId("somersault_assiduous.PR.headstand_done", doc_frags), + oid=None, short_name="headstand_done", long_name=None, description=None, @@ -2186,6 +2292,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -2198,6 +2305,7 @@ class SomersaultSID(IntEnum): ), # TODO (?): non-byte aligned MatchingRequestParameters MatchingRequestParameter( + oid=None, short_name="duration", long_name=None, semantic=None, @@ -2218,6 +2326,7 @@ class SomersaultSID(IntEnum): "fell_over": Response( odx_id=OdxLinkId("somersault_assiduous.NR.fell_over", doc_frags), + oid=None, short_name="fell_over", long_name=None, description=None, @@ -2226,6 +2335,7 @@ class SomersaultSID(IntEnum): response_type=ResponseType.POSITIVE, parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, semantic=None, @@ -2238,6 +2348,7 @@ class SomersaultSID(IntEnum): ), # TODO (?): non-byte aligned MatchingRequestParameters MatchingRequestParameter( + oid=None, short_name="duration", long_name=None, semantic=None, @@ -2258,6 +2369,7 @@ class SomersaultSID(IntEnum): "headstand": DiagService( odx_id=OdxLinkId("somersault_assiduous.service.headstand", doc_frags), + oid=None, short_name="headstand", long_name=None, description=None, @@ -2303,6 +2415,7 @@ class SomersaultSID(IntEnum): somersault_assiduous_ecu_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("somersault_assiduous", doc_frags), + oid=None, short_name="somersault_assiduous", long_name="Somersault assiduous ECU", description=Description.from_string( @@ -2362,6 +2475,7 @@ class SomersaultSID(IntEnum): # create a "diagnosis layer container" object somersault_dlc = DiagLayerContainer( odx_id=OdxLinkId("DLC.somersault", doc_frags), + oid=None, short_name=dlc_short_name, long_name="Collect all saults in the summer", description=Description.from_string( diff --git a/odxtools/element.py b/odxtools/element.py index 6d3b33dc..1ddc4dbf 100644 --- a/odxtools/element.py +++ b/odxtools/element.py @@ -15,10 +15,7 @@ class NamedElement: description: Optional[Description] @staticmethod - def from_et( - et_element: ElementTree.Element, - doc_frags: List[OdxDocFragment], - ) -> "NamedElement": + def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> "NamedElement": return NamedElement( short_name=odxrequire(et_element.findtext("SHORT-NAME")), @@ -30,15 +27,15 @@ def from_et( @dataclass class IdentifiableElement(NamedElement): odx_id: OdxLinkId + oid: Optional[str] @staticmethod - def from_et( - et_element: ElementTree.Element, - doc_frags: List[OdxDocFragment], - ) -> "IdentifiableElement": + def from_et(et_element: ElementTree.Element, + doc_frags: List[OdxDocFragment]) -> "IdentifiableElement": kwargs = dataclass_fields_asdict(NamedElement.from_et(et_element, doc_frags)) - return IdentifiableElement( - **kwargs, - odx_id=odxrequire(OdxLinkId.from_et(et_element, doc_frags)), - ) + + odx_id = odxrequire(OdxLinkId.from_et(et_element, doc_frags)) + oid = et_element.get("OID") + + return IdentifiableElement(**kwargs, odx_id=odx_id, oid=oid) diff --git a/odxtools/outputparam.py b/odxtools/outputparam.py index 21544311..ee9a283d 100644 --- a/odxtools/outputparam.py +++ b/odxtools/outputparam.py @@ -16,7 +16,6 @@ @dataclass class OutputParam(IdentifiableElement): dop_base_ref: OdxLinkRef - oid: Optional[str] semantic: Optional[str] @staticmethod @@ -25,9 +24,8 @@ def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags)) dop_base_ref = odxrequire(OdxLinkRef.from_et(et_element.find("DOP-BASE-REF"), doc_frags)) semantic = et_element.get("SEMANTIC") - oid = et_element.get("OID") - return OutputParam(dop_base_ref=dop_base_ref, semantic=semantic, oid=oid, **kwargs) + return OutputParam(dop_base_ref=dop_base_ref, semantic=semantic, **kwargs) def _build_odxlinks(self) -> Dict[OdxLinkId, Any]: return {} diff --git a/odxtools/parameters/parameter.py b/odxtools/parameters/parameter.py index d121022e..3420bb95 100644 --- a/odxtools/parameters/parameter.py +++ b/odxtools/parameters/parameter.py @@ -40,6 +40,7 @@ class Parameter(NamedElement): define any non-positionable parameter types. """ + oid: Optional[str] byte_position: Optional[int] bit_position: Optional[int] semantic: Optional[str] @@ -51,6 +52,7 @@ def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> kwargs = dataclass_fields_asdict(NamedElement.from_et(et_element, doc_frags)) + oid = et_element.get("OID") semantic = et_element.get("SEMANTIC") sdgs = [ SpecialDataGroup.from_et(sdge, doc_frags) for sdge in et_element.iterfind("SDGS/SDG") @@ -63,6 +65,7 @@ def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> bit_position = int(bit_position_str) if bit_position_str is not None else None return Parameter( + oid=oid, byte_position=byte_position, bit_position=bit_position, semantic=semantic, diff --git a/odxtools/physicaldimension.py b/odxtools/physicaldimension.py index 7ddb1646..c73af95b 100644 --- a/odxtools/physicaldimension.py +++ b/odxtools/physicaldimension.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT from dataclasses import dataclass -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List from xml.etree import ElementTree from .element import IdentifiableElement @@ -41,7 +41,6 @@ class PhysicalDimension(IdentifiableElement): ) ``` """ - oid: Optional[str] length_exp: int mass_exp: int time_exp: int @@ -54,7 +53,6 @@ class PhysicalDimension(IdentifiableElement): def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> "PhysicalDimension": kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags)) - oid = et_element.get("OID") def read_optional_int(element: ElementTree.Element, name: str) -> int: if val_str := element.findtext(name): @@ -71,7 +69,6 @@ def read_optional_int(element: ElementTree.Element, name: str) -> int: luminous_intensity_exp = read_optional_int(et_element, "LUMINOUS-INTENSITY-EXP") return PhysicalDimension( - oid=oid, length_exp=length_exp, mass_exp=mass_exp, time_exp=time_exp, diff --git a/odxtools/templates/macros/printAudience.xml.jinja2 b/odxtools/templates/macros/printAudience.xml.jinja2 index f6fbdc9a..6740ed5c 100644 --- a/odxtools/templates/macros/printAudience.xml.jinja2 +++ b/odxtools/templates/macros/printAudience.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printAdditionalAudience(audience) -%} - + {{ peid.printElementIdSubtags(audience)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printCompanyData.xml.jinja2 b/odxtools/templates/macros/printCompanyData.xml.jinja2 index 5f429a17..98ad5202 100644 --- a/odxtools/templates/macros/printCompanyData.xml.jinja2 +++ b/odxtools/templates/macros/printCompanyData.xml.jinja2 @@ -8,7 +8,7 @@ {%- import('macros/printDescription.xml.jinja2') as pd %} {%- macro printCompanyData(company_data) %} - + {{ peid.printElementIdSubtags(company_data)|indent(1) }} {%- if company_data.roles is not none %} @@ -20,7 +20,7 @@ {%- if company_data.team_members is not none %} {%- for team_member in company_data.team_members %} - + {{ peid.printElementIdSubtags(team_member)|indent(3) }} {%- if team_member.roles is not none %} diff --git a/odxtools/templates/macros/printComparam.xml.jinja2 b/odxtools/templates/macros/printComparam.xml.jinja2 index 6b3c0587..9ca3d028 100644 --- a/odxtools/templates/macros/printComparam.xml.jinja2 +++ b/odxtools/templates/macros/printComparam.xml.jinja2 @@ -38,7 +38,7 @@ {%- endmacro %} {%- macro printSimpleComparam(cp) %} - {%- else %} - + {{dtc.short_name}} {{dtc.trouble_code}} {%- if dtc.display_trouble_code is not none %} diff --git a/odxtools/templates/macros/printDiagComm.xml.jinja2 b/odxtools/templates/macros/printDiagComm.xml.jinja2 index 980e43c4..4aeca8ef 100644 --- a/odxtools/templates/macros/printDiagComm.xml.jinja2 +++ b/odxtools/templates/macros/printDiagComm.xml.jinja2 @@ -9,7 +9,7 @@ {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printDiagCommAttribs(dc) -%} -ID="{{dc.odx_id.local_id}}" +{{-peid.printElementIdAttribs(dc)}} {{-make_xml_attrib("SEMANTIC", dc.semantic)}} {{-make_xml_attrib("DIAGNOSTIC-CLASS", dc.diagnostic_class and dc.diagnostic_class.value)}} {{-make_bool_xml_attrib("IS-MANDATORY", dc.is_mandatory_raw)}} diff --git a/odxtools/templates/macros/printDiagLayer.xml.jinja2 b/odxtools/templates/macros/printDiagLayer.xml.jinja2 index cefb511a..abf8ff92 100644 --- a/odxtools/templates/macros/printDiagLayer.xml.jinja2 +++ b/odxtools/templates/macros/printDiagLayer.xml.jinja2 @@ -27,7 +27,7 @@ {%- import('macros/printAdminData.xml.jinja2') as pad %} {%- macro printDiagLayerAttribs(dl) -%} -{#- #} ID="{{dl.diag_layer_raw.odx_id.local_id}}"{# -#} +{#- #} {{-peid.printElementIdAttribs(dl)}}{# -#} {%- endmacro -%} {%- macro printDiagLayerSubtags(dl) -%} diff --git a/odxtools/templates/macros/printDiagVariable.xml.jinja2 b/odxtools/templates/macros/printDiagVariable.xml.jinja2 index ddf37a8b..60feb7eb 100644 --- a/odxtools/templates/macros/printDiagVariable.xml.jinja2 +++ b/odxtools/templates/macros/printDiagVariable.xml.jinja2 @@ -7,7 +7,7 @@ {%- import('macros/printDescription.xml.jinja2') as pd %} {%- macro printDiagVariable(diag_var) -%} - + {{ peid.printElementIdSubtags(diag_variable)|indent(2) }} {%- if diag_variable.admin_data is not none %} {{ pad.printAdminData(diag_variable.admin_data)|indent(2) }} @@ -16,7 +16,7 @@ {%- if diag_variable.sw_variables %} {%- for sw_var in diag_variable.sw_variables %} - + {{ peid.printElementIdSubtags(sw_var)|indent(6) }} {%- if sw_var.origin is not none %} {{ sw_var.origin }} @@ -60,7 +60,7 @@ {%- endmacro -%} {%- macro printVariableGroup(var_group) -%} - + {{ peid.printElementIdSubtags(diag_variable)|indent(2) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 b/odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 index e98758e6..25a1109b 100644 --- a/odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +++ b/odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printStaticField(demf) -%} - + {{ peid.printElementIdSubtags(demf)|indent(1) }} diff --git a/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 index dfeb73ea..fc729d9f 100644 --- a/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +++ b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printDynamicLengthField(dlf) -%} - + {{ peid.printElementIdSubtags(dlf)|indent(1) }} {{dlf.offset}} diff --git a/odxtools/templates/macros/printElementId.xml.jinja2 b/odxtools/templates/macros/printElementId.xml.jinja2 index ca5219fa..da83bd42 100644 --- a/odxtools/templates/macros/printElementId.xml.jinja2 +++ b/odxtools/templates/macros/printElementId.xml.jinja2 @@ -5,6 +5,11 @@ {%- import('macros/printDescription.xml.jinja2') as pd %} +{%- macro printElementIdAttribs(obj) -%} +{#- #} {{- make_xml_attrib("ID", obj.odx_id.local_id) }} +{#- #} {{- make_xml_attrib("OID", getattr(obj, "oid", none)) -}} +{%- endmacro -%} + {%- macro printElementIdSubtags(obj) -%} {{ obj.short_name }} {%- if obj.long_name %} diff --git a/odxtools/templates/macros/printEndOfPdu.xml.jinja2 b/odxtools/templates/macros/printEndOfPdu.xml.jinja2 index 2f1cef45..2b35eb31 100644 --- a/odxtools/templates/macros/printEndOfPdu.xml.jinja2 +++ b/odxtools/templates/macros/printEndOfPdu.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printEndOfPdu(eopdu) -%} - + {{ peid.printElementIdSubtags(eopdu)|indent(1) }} {%- if eopdu.max_number_of_items is not none %} diff --git a/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 b/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 index 34cde9e9..e5ca0d03 100644 --- a/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +++ b/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printEnvDataDesc(env_data_desc) %} - + {{ peid.printElementIdSubtags(env_data_desc)|indent(1) }} diff --git a/odxtools/templates/macros/printFunctionalClass.xml.jinja2 b/odxtools/templates/macros/printFunctionalClass.xml.jinja2 index 3b11ed97..1a8d59bf 100644 --- a/odxtools/templates/macros/printFunctionalClass.xml.jinja2 +++ b/odxtools/templates/macros/printFunctionalClass.xml.jinja2 @@ -7,7 +7,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printFunctionalClass(fc) -%} - + {{ peid.printElementIdSubtags(fc)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printMux.xml.jinja2 b/odxtools/templates/macros/printMux.xml.jinja2 index 8519acd7..b948486a 100644 --- a/odxtools/templates/macros/printMux.xml.jinja2 +++ b/odxtools/templates/macros/printMux.xml.jinja2 @@ -8,7 +8,7 @@ {%- import('macros/printDOP.xml.jinja2') as pdop %} {%- macro printMux(mux) %} - {{ peid.printElementIdSubtags(mux)|indent(1) }} diff --git a/odxtools/templates/macros/printParam.xml.jinja2 b/odxtools/templates/macros/printParam.xml.jinja2 index 6c711328..bded934b 100644 --- a/odxtools/templates/macros/printParam.xml.jinja2 +++ b/odxtools/templates/macros/printParam.xml.jinja2 @@ -11,8 +11,8 @@ {%- set semattrib = make_xml_attrib("SEMANTIC", param.semantic) -%} {%- if param.parameter_type == "TABLE-KEY" %} + {{-peid.printElementIdAttribs(param)}} + xsi:type="{{param.parameter_type}}"> {%- elif param.parameter_type == "SYSTEM" %} + {{ peid.printElementIdSubtags(ps) | indent(1) }} {{ ps.pdu_protocol_type }} {{ ps.physical_link_type }} diff --git a/odxtools/templates/macros/printRequest.xml.jinja2 b/odxtools/templates/macros/printRequest.xml.jinja2 index 5dcdce27..ef3d6d1d 100644 --- a/odxtools/templates/macros/printRequest.xml.jinja2 +++ b/odxtools/templates/macros/printRequest.xml.jinja2 @@ -9,7 +9,7 @@ {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printRequest(request) -%} - + {{ peid.printElementIdSubtags(request)|indent(1) }} {%- if request.parameters %} diff --git a/odxtools/templates/macros/printResponse.xml.jinja2 b/odxtools/templates/macros/printResponse.xml.jinja2 index 6066cae0..fc07ac6d 100644 --- a/odxtools/templates/macros/printResponse.xml.jinja2 +++ b/odxtools/templates/macros/printResponse.xml.jinja2 @@ -8,7 +8,7 @@ {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printResponse(resp, tag_name="POS-RESPONSE") -%} -<{{tag_name}} ID="{{resp.odx_id.local_id}}"> +<{{tag_name}} {{-peid.printElementIdAttribs(resp)}}> {{ peid.printElementIdSubtags(resp)|indent(1) }} {%- if resp.parameters %} diff --git a/odxtools/templates/macros/printSingleEcuJob.xml.jinja2 b/odxtools/templates/macros/printSingleEcuJob.xml.jinja2 index 5292a1aa..5d7730b1 100644 --- a/odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +++ b/odxtools/templates/macros/printSingleEcuJob.xml.jinja2 @@ -73,7 +73,7 @@ {%- endmacro -%} {%- macro printOutputParam(param) -%} - {{ peid.printElementIdSubtags(param)|indent(1) }} diff --git a/odxtools/templates/macros/printSpecialData.xml.jinja2 b/odxtools/templates/macros/printSpecialData.xml.jinja2 index 64134ab2..c3f75586 100644 --- a/odxtools/templates/macros/printSpecialData.xml.jinja2 +++ b/odxtools/templates/macros/printSpecialData.xml.jinja2 @@ -17,7 +17,7 @@ {%- endmacro %} {%- macro printSdgCaption(sdg_caption) %} - + {{ peid.printElementIdSubtags(sdg_caption)|indent(1) }} {%- endmacro %} diff --git a/odxtools/templates/macros/printState.xml.jinja2 b/odxtools/templates/macros/printState.xml.jinja2 index 20f05032..ec520b0d 100644 --- a/odxtools/templates/macros/printState.xml.jinja2 +++ b/odxtools/templates/macros/printState.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printState(state) -%} - + {{ peid.printElementIdSubtags(state)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printStateChart.xml.jinja2 b/odxtools/templates/macros/printStateChart.xml.jinja2 index 61b12839..0fecfc47 100644 --- a/odxtools/templates/macros/printStateChart.xml.jinja2 +++ b/odxtools/templates/macros/printStateChart.xml.jinja2 @@ -8,7 +8,7 @@ {%- import('macros/printStateTransition.xml.jinja2') as pst %} {%- macro printStateChart(state_chart) -%} - + {{ peid.printElementIdSubtags(state_chart)|indent(1) }} {{state_chart.semantic}} {%- if state_chart.state_transitions %} diff --git a/odxtools/templates/macros/printStateTransition.xml.jinja2 b/odxtools/templates/macros/printStateTransition.xml.jinja2 index 494fa64f..d7f99691 100644 --- a/odxtools/templates/macros/printStateTransition.xml.jinja2 +++ b/odxtools/templates/macros/printStateTransition.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printStateTransition(state_transition) -%} - + {{ peid.printElementIdSubtags(state_transition)|indent(1) }} diff --git a/odxtools/templates/macros/printStaticField.xml.jinja2 b/odxtools/templates/macros/printStaticField.xml.jinja2 index 675b04ac..c9d6c2eb 100644 --- a/odxtools/templates/macros/printStaticField.xml.jinja2 +++ b/odxtools/templates/macros/printStaticField.xml.jinja2 @@ -6,7 +6,7 @@ {%- import('macros/printElementId.xml.jinja2') as peid %} {%- macro printStaticField(sf) -%} - + {{ peid.printElementIdSubtags(sf)|indent(1) }} {{sf.fixed_number_of_items}} diff --git a/odxtools/templates/macros/printStructure.xml.jinja2 b/odxtools/templates/macros/printStructure.xml.jinja2 index 8252db8a..48bba586 100644 --- a/odxtools/templates/macros/printStructure.xml.jinja2 +++ b/odxtools/templates/macros/printStructure.xml.jinja2 @@ -7,7 +7,7 @@ {%- import('macros/printParam.xml.jinja2') as pp %} {%- macro printStructure(st) -%} - + {{ peid.printElementIdSubtags(st)|indent(1) }} {%- if st.byte_size is not none %} {{st.byte_size}} diff --git a/odxtools/templates/macros/printTable.xml.jinja2 b/odxtools/templates/macros/printTable.xml.jinja2 index 5cf1b083..5c55915a 100644 --- a/odxtools/templates/macros/printTable.xml.jinja2 +++ b/odxtools/templates/macros/printTable.xml.jinja2 @@ -8,7 +8,7 @@ {%- import('macros/printDescription.xml.jinja2') as pd %} {%- macro printTable(table) %} - {{ peid.printElementIdSubtags(table)|indent(1) }} {%- if table.key_dop_ref %} @@ -16,7 +16,7 @@ {%- endif %} {%- for table_row in table.table_rows_raw %} {%- if hasattr(table_row, "key") %} - {{table_row.short_name}} {%- if table_row.long_name %} diff --git a/odxtools/templates/macros/printUnitSpec.xml.jinja2 b/odxtools/templates/macros/printUnitSpec.xml.jinja2 index 7d123b2c..c4836b12 100644 --- a/odxtools/templates/macros/printUnitSpec.xml.jinja2 +++ b/odxtools/templates/macros/printUnitSpec.xml.jinja2 @@ -35,8 +35,7 @@ {%- macro printUnit(unit) -%} - + {{ peid.printElementIdSubtags(unit)|indent(1) }} {{ unit.display_name }} {%- if unit.factor_si_to_unit is not none %} @@ -52,7 +51,7 @@ {%- endmacro -%} {%- macro printUnitGroup(group) -%} - + {{ peid.printElementIdSubtags(group)|indent(1) }} {{ group.category.value }} {%- if group.unit_refs %} @@ -66,8 +65,7 @@ {%- endmacro -%} {%- macro printPhysicalDimesion(dim) -%} - + {{ peid.printElementIdSubtags(dim)|indent(1) }} {%- if dim.length_exp %} {{ dim.length_exp }} diff --git a/odxtools/unit.py b/odxtools/unit.py index a5642451..18eda947 100644 --- a/odxtools/unit.py +++ b/odxtools/unit.py @@ -53,7 +53,6 @@ class Unit(IdentifiableElement): ``` """ display_name: str - oid: Optional[str] factor_si_to_unit: Optional[float] offset_si_to_unit: Optional[float] physical_dimension_ref: Optional[OdxLinkRef] @@ -64,7 +63,7 @@ def __post_init__(self) -> None: @staticmethod def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> "Unit": kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags)) - oid = et_element.get("OID") + display_name = odxrequire(et_element.findtext("DISPLAY-NAME")) def read_optional_float(element: ElementTree.Element, name: str) -> Optional[float]: @@ -80,7 +79,6 @@ def read_optional_float(element: ElementTree.Element, name: str) -> Optional[flo return Unit( display_name=display_name, - oid=oid, factor_si_to_unit=factor_si_to_unit, offset_si_to_unit=offset_si_to_unit, physical_dimension_ref=physical_dimension_ref, diff --git a/odxtools/writepdxfile.py b/odxtools/writepdxfile.py index 7ad05869..360d9eb1 100644 --- a/odxtools/writepdxfile.py +++ b/odxtools/writepdxfile.py @@ -140,6 +140,7 @@ def write_pdx_file( out_file.write(data_file.read()) jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_dir)) + jinja_env.globals["getattr"] = getattr jinja_env.globals["hasattr"] = hasattr jinja_env.globals["odxraise"] = jinja2_odxraise_helper jinja_env.globals["make_xml_attrib"] = make_xml_attrib diff --git a/tests/test_decoding.py b/tests/test_decoding.py index 37f20b9d..0af1e9b8 100644 --- a/tests/test_decoding.py +++ b/tests/test_decoding.py @@ -66,6 +66,7 @@ def test_prefix_tree_construction(self) -> None: is_highlow_byte_order_raw=None, ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -77,6 +78,7 @@ def test_prefix_tree_construction(self) -> None: sdgs=[], ) req_param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_2", long_name=None, description=None, @@ -89,6 +91,7 @@ def test_prefix_tree_construction(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -101,6 +104,7 @@ def test_prefix_tree_construction(self) -> None: odxlinks.update({req.odx_id: req}) service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -128,6 +132,7 @@ def test_prefix_tree_construction(self) -> None: ) req2_param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_3", long_name=None, description=None, @@ -140,6 +145,7 @@ def test_prefix_tree_construction(self) -> None: ) req2 = Request( odx_id=OdxLinkId("request_id2", doc_frags), + oid=None, short_name="request_sn2", long_name=None, description=None, @@ -151,6 +157,7 @@ def test_prefix_tree_construction(self) -> None: odxlinks.update({req2.odx_id: req2}) resp2_param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_4", long_name=None, description=None, @@ -163,6 +170,7 @@ def test_prefix_tree_construction(self) -> None: ) resp2 = Response( odx_id=OdxLinkId("response_id2", doc_frags), + oid=None, short_name="response_sn2", long_name=None, description=None, @@ -176,6 +184,7 @@ def test_prefix_tree_construction(self) -> None: service2 = DiagService( odx_id=OdxLinkId("service_id2", doc_frags), + oid=None, short_name="service_sn2", long_name=None, description=None, @@ -205,6 +214,7 @@ def test_prefix_tree_construction(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -263,6 +273,7 @@ def test_decode_request_coded_const(self) -> None: is_highlow_byte_order_raw=None, ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -274,6 +285,7 @@ def test_decode_request_coded_const(self) -> None: sdgs=[], ) req_param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_2", long_name=None, description=None, @@ -286,6 +298,7 @@ def test_decode_request_coded_const(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -297,6 +310,7 @@ def test_decode_request_coded_const(self) -> None: service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -325,6 +339,7 @@ def test_decode_request_coded_const(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -383,6 +398,7 @@ def test_decode_nrc_const(self) -> None: ) dop = DataObjectProperty( odx_id=OdxLinkId("dop.id", doc_frags), + oid=None, short_name="dop_sn", long_name="example dop", description=None, @@ -401,6 +417,7 @@ def test_decode_nrc_const(self) -> None: physical_constr=None, ) param1 = CodedConstParameter( + oid=None, short_name="param1", long_name=None, description=None, @@ -412,6 +429,7 @@ def test_decode_nrc_const(self) -> None: sdgs=[], ) param2 = NrcConstParameter( + oid=None, short_name="param2", long_name=None, description=None, @@ -423,6 +441,7 @@ def test_decode_nrc_const(self) -> None: sdgs=[], ) param3 = ValueParameter( + oid=None, short_name="param3", long_name=None, description=None, @@ -436,6 +455,7 @@ def test_decode_nrc_const(self) -> None: ) resp = Response( odx_id=OdxLinkId("response_id", doc_frags), + oid=None, short_name="response_sn", long_name=None, description=None, @@ -448,6 +468,7 @@ def test_decode_nrc_const(self) -> None: req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -455,6 +476,7 @@ def test_decode_nrc_const(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="req_param1", long_name=None, description=None, @@ -471,6 +493,7 @@ def test_decode_nrc_const(self) -> None: service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -500,6 +523,7 @@ def test_decode_nrc_const(self) -> None: base_variant_raw = BaseVariantRaw( variant_type=DiagLayerType.BASE_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -576,6 +600,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: is_highlow_byte_order_raw=None, ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -587,6 +612,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: sdgs=[], ) req_param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_2", long_name=None, description=None, @@ -598,6 +624,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: sdgs=[], ) req_param3 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_3", long_name=None, description=None, @@ -609,6 +636,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: sdgs=[], ) req_param4 = CodedConstParameter( + oid=None, short_name="coded_const_parameter_4", long_name=None, description=None, @@ -621,6 +649,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -634,6 +663,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: odxlinks.update({req.odx_id: req}) service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -662,6 +692,7 @@ def test_decode_request_coded_const_undefined_byte_position(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -746,6 +777,7 @@ def test_decode_request_structure(self) -> None: physical_type=DataType.A_INT32) dop = DataObjectProperty( odx_id=OdxLinkId("dop.odx_id", doc_frags), + oid=None, short_name="dop_sn", long_name=None, description=None, @@ -760,6 +792,7 @@ def test_decode_request_structure(self) -> None: ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -772,6 +805,7 @@ def test_decode_request_structure(self) -> None: ) struct_param1 = CodedConstParameter( + oid=None, short_name="struct_param_1", long_name=None, description=None, @@ -783,6 +817,7 @@ def test_decode_request_structure(self) -> None: sdgs=[], ) struct_param2 = ValueParameter( + oid=None, short_name="struct_param_2", long_name=None, description=None, @@ -796,6 +831,7 @@ def test_decode_request_structure(self) -> None: ) struct = Structure( odx_id=OdxLinkId("struct_id", doc_frags), + oid=None, short_name="struct", long_name=None, description=None, @@ -805,6 +841,7 @@ def test_decode_request_structure(self) -> None: byte_size=None, ) req_param2 = ValueParameter( + oid=None, short_name="structured_param", long_name=None, description=None, @@ -819,6 +856,7 @@ def test_decode_request_structure(self) -> None: req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -829,6 +867,7 @@ def test_decode_request_structure(self) -> None: ) service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -857,6 +896,7 @@ def test_decode_request_structure(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -939,6 +979,7 @@ def test_static_field_coding(self) -> None: physical_type=DataType.A_INT32) dop = DataObjectProperty( odx_id=OdxLinkId("static_field.dop.id", doc_frags), + oid=None, short_name="static_field_dop_sn", long_name=None, description=None, @@ -953,6 +994,7 @@ def test_static_field_coding(self) -> None: ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -965,6 +1007,7 @@ def test_static_field_coding(self) -> None: ) struct_param1 = ValueParameter( + oid=None, short_name="static_field_struct_param_1", long_name=None, description=None, @@ -977,6 +1020,7 @@ def test_static_field_coding(self) -> None: sdgs=[], ) struct_param2 = ValueParameter( + oid=None, short_name="static_field_struct_param_2", long_name=None, description=None, @@ -990,6 +1034,7 @@ def test_static_field_coding(self) -> None: ) struct = Structure( odx_id=OdxLinkId("static_field_struct.id", doc_frags), + oid=None, short_name="static_field_struct", long_name=None, description=None, @@ -1000,6 +1045,7 @@ def test_static_field_coding(self) -> None: ) static_field = StaticField( odx_id=OdxLinkId("static_field.id", doc_frags), + oid=None, short_name="static_field_sn", long_name=None, description=None, @@ -1014,6 +1060,7 @@ def test_static_field_coding(self) -> None: item_byte_size=3, ) req_param2 = ValueParameter( + oid=None, short_name="static_field_param", long_name=None, description=None, @@ -1028,6 +1075,7 @@ def test_static_field_coding(self) -> None: req = Request( odx_id=OdxLinkId("static_field.request.id", doc_frags), + oid=None, short_name="static_field_request_sn", long_name=None, description=None, @@ -1038,6 +1086,7 @@ def test_static_field_coding(self) -> None: ) service = DiagService( odx_id=OdxLinkId("static_field.service.id", doc_frags), + oid=None, short_name="static_field_service_sn", long_name=None, description=None, @@ -1066,6 +1115,7 @@ def test_static_field_coding(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl.id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -1184,6 +1234,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: dop = DataObjectProperty( odx_id=OdxLinkId("demf.dop.id", doc_frags), + oid=None, short_name="demf_dop_sn", long_name=None, description=None, @@ -1198,6 +1249,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) dyn_end_dop = DataObjectProperty( odx_id=OdxLinkId("demf.end_dop.id", doc_frags), + oid=None, short_name="demf_end_dop_sn", long_name=None, description=None, @@ -1217,6 +1269,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -1228,6 +1281,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: sdgs=[], ) req_param1_1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -1240,6 +1294,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) struct_param1 = CodedConstParameter( + oid=None, short_name="struct_param_1", long_name=None, description=None, @@ -1251,6 +1306,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: sdgs=[], ) struct_param2 = ValueParameter( + oid=None, short_name="struct_param_2", long_name=None, description=None, @@ -1264,6 +1320,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) struct = Structure( odx_id=OdxLinkId("demf_struct.id", doc_frags), + oid=None, short_name="demf_struct", long_name=None, description=None, @@ -1274,6 +1331,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) demf = DynamicEndmarkerField( odx_id=OdxLinkId("demf.id", doc_frags), + oid=None, short_name="demf_sn", long_name=None, description=None, @@ -1287,6 +1345,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: dyn_end_dop_ref=dyn_end_dop_ref, ) req_param2 = ValueParameter( + oid=None, short_name="demf_param", long_name=None, description=None, @@ -1299,6 +1358,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: sdgs=[], ) req_demf_endmarker_param = ReservedParameter( + oid=None, short_name="demf_endmarker", long_name=None, description=None, @@ -1309,6 +1369,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: sdgs=[], ) req_param3 = CodedConstParameter( + oid=None, short_name="demf_post_param", long_name=None, description=None, @@ -1322,6 +1383,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: req = Request( odx_id=OdxLinkId("demf.request.id", doc_frags), + oid=None, short_name="demf_request_sn", long_name=None, description=None, @@ -1336,6 +1398,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: # field is at the end of the PDU, so no endmarker is added req_end_of_pdu = Request( odx_id=OdxLinkId("demf_eopdu.request.id", doc_frags), + oid=None, short_name="demf_eopdu_request_sn", long_name=None, description=None, @@ -1347,6 +1410,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: service = DiagService( odx_id=OdxLinkId("demf.service.id", doc_frags), + oid=None, short_name="demf_service_sn", long_name=None, description=None, @@ -1374,6 +1438,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ) service_eopdu = DiagService( odx_id=OdxLinkId("demf.service_eopdu.id", doc_frags), + oid=None, short_name="demf_service_eopdu_sn", long_name=None, description=None, @@ -1402,6 +1467,7 @@ def test_dynamic_endmarker_field_coding(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl.id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -1549,6 +1615,7 @@ def test_dynamic_length_field_coding(self) -> None: physical_type=DataType.A_INT32) dop = DataObjectProperty( odx_id=OdxLinkId("dlf.dop.id", doc_frags), + oid=None, short_name="dlf_dop_sn", long_name=None, description=None, @@ -1563,6 +1630,7 @@ def test_dynamic_length_field_coding(self) -> None: ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -1575,6 +1643,7 @@ def test_dynamic_length_field_coding(self) -> None: ) struct_param1 = CodedConstParameter( + oid=None, short_name="struct_param_1", long_name=None, description=None, @@ -1586,6 +1655,7 @@ def test_dynamic_length_field_coding(self) -> None: sdgs=[], ) struct_param2 = ValueParameter( + oid=None, short_name="struct_param_2", long_name=None, description=None, @@ -1599,6 +1669,7 @@ def test_dynamic_length_field_coding(self) -> None: ) struct = Structure( odx_id=OdxLinkId("dlf_struct.id", doc_frags), + oid=None, short_name="dlf_struct", long_name=None, description=None, @@ -1611,6 +1682,7 @@ def test_dynamic_length_field_coding(self) -> None: byte_position=1, bit_position=3, dop_ref=OdxLinkRef.from_id(dop.odx_id)) dlf = DynamicLengthField( odx_id=OdxLinkId("dlf.id", doc_frags), + oid=None, short_name="dlf_sn", long_name=None, description=None, @@ -1625,6 +1697,7 @@ def test_dynamic_length_field_coding(self) -> None: determine_number_of_items=det_num_items, ) req_param2 = ValueParameter( + oid=None, short_name="dlf_param", long_name=None, description=None, @@ -1639,6 +1712,7 @@ def test_dynamic_length_field_coding(self) -> None: req = Request( odx_id=OdxLinkId("dlf.request.id", doc_frags), + oid=None, short_name="dlf_request_sn", long_name=None, description=None, @@ -1649,6 +1723,7 @@ def test_dynamic_length_field_coding(self) -> None: ) service = DiagService( odx_id=OdxLinkId("dlf.service.id", doc_frags), + oid=None, short_name="dlf_service_sn", long_name=None, description=None, @@ -1677,6 +1752,7 @@ def test_dynamic_length_field_coding(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl.id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -1783,6 +1859,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: physical_type=DataType.A_INT32) dop = DataObjectProperty( odx_id=OdxLinkId("dop.id", doc_frags), + oid=None, short_name="dop_sn", long_name=None, description=None, @@ -1797,6 +1874,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -1809,6 +1887,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ) struct_param1 = CodedConstParameter( + oid=None, short_name="struct_param_1", long_name=None, description=None, @@ -1820,6 +1899,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: sdgs=[], ) struct_param2 = ValueParameter( + oid=None, short_name="struct_param_2", long_name=None, description=None, @@ -1833,6 +1913,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ) struct = Structure( odx_id=OdxLinkId("struct_id", doc_frags), + oid=None, short_name="struct", long_name=None, description=None, @@ -1843,6 +1924,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ) eopf = EndOfPduField( odx_id=OdxLinkId("eopf_id", doc_frags), + oid=None, short_name="eopf_sn", long_name=None, description=None, @@ -1857,6 +1939,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: is_visible_raw=True, ) req_param2 = ValueParameter( + oid=None, short_name="eopf_param", long_name=None, description=None, @@ -1871,6 +1954,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -1881,6 +1965,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ) service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -1909,6 +1994,7 @@ def test_decode_request_end_of_pdu_field(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -2015,6 +2101,7 @@ def test_decode_request_linear_compu_method(self) -> None: ) dop = DataObjectProperty( odx_id=OdxLinkId("linear.dop.id", doc_frags), + oid=None, short_name="linear_dop_sn", long_name=None, description=None, @@ -2028,6 +2115,7 @@ def test_decode_request_linear_compu_method(self) -> None: physical_constr=None, ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2039,6 +2127,7 @@ def test_decode_request_linear_compu_method(self) -> None: sdgs=[], ) req_param2 = ValueParameter( + oid=None, short_name="value_parameter_2", long_name=None, description=None, @@ -2052,6 +2141,7 @@ def test_decode_request_linear_compu_method(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -2063,6 +2153,7 @@ def test_decode_request_linear_compu_method(self) -> None: service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -2091,6 +2182,7 @@ def test_decode_request_linear_compu_method(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -2162,6 +2254,7 @@ def test_decode_response(self) -> None: is_highlow_byte_order_raw=None, ) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2173,6 +2266,7 @@ def test_decode_response(self) -> None: sdgs=[], ) req_param2 = CodedConstParameter( + oid=None, short_name="req_param", long_name=None, description=None, @@ -2185,6 +2279,7 @@ def test_decode_response(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -2195,6 +2290,7 @@ def test_decode_response(self) -> None: ) resp_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2206,6 +2302,7 @@ def test_decode_response(self) -> None: sdgs=[], ) resp_param2 = MatchingRequestParameter( + oid=None, short_name="matching_req_param", long_name=None, description=None, @@ -2218,6 +2315,7 @@ def test_decode_response(self) -> None: ) pos_response = Response( odx_id=OdxLinkId("pos_response_id", doc_frags), + oid=None, short_name="pos_response_sn", long_name=None, description=None, @@ -2229,6 +2327,7 @@ def test_decode_response(self) -> None: ) resp_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2240,6 +2339,7 @@ def test_decode_response(self) -> None: sdgs=[], ) resp_param2 = MatchingRequestParameter( + oid=None, short_name="matching_req_param", long_name=None, description=None, @@ -2252,6 +2352,7 @@ def test_decode_response(self) -> None: ) neg_response = Response( odx_id=OdxLinkId("neg_response_id", doc_frags), + oid=None, short_name="neg_response_sn", long_name=None, description=None, @@ -2264,6 +2365,7 @@ def test_decode_response(self) -> None: service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -2292,6 +2394,7 @@ def test_decode_response(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -2358,6 +2461,7 @@ def test_code_dtc(self) -> None: dtc1 = DiagnosticTroubleCode( odx_id=OdxLinkId("dtcID1", doc_frags), + oid=None, short_name="P34_sn", long_name=None, description=None, @@ -2371,6 +2475,7 @@ def test_code_dtc(self) -> None: dtc2 = DiagnosticTroubleCode( odx_id=OdxLinkId("dtcID2", doc_frags), + oid=None, short_name="P56_sn", long_name=None, description=None, @@ -2383,6 +2488,7 @@ def test_code_dtc(self) -> None: ) dop = DtcDop( odx_id=OdxLinkId("dtc.dop.odx_id", doc_frags), + oid=None, short_name="dtc_dop_sn", long_name=None, description=None, @@ -2397,6 +2503,7 @@ def test_code_dtc(self) -> None: ) odxlinks.update(dop._build_odxlinks()) resp_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2408,6 +2515,7 @@ def test_code_dtc(self) -> None: sdgs=[], ) resp_param2 = ValueParameter( + oid=None, short_name="DTC_Param", long_name=None, description=None, @@ -2421,6 +2529,7 @@ def test_code_dtc(self) -> None: ) pos_response = Response( odx_id=OdxLinkId("pos_response_id", doc_frags), + oid=None, short_name="pos_response_sn", long_name=None, description=None, @@ -2452,6 +2561,7 @@ def setUp(self) -> None: odxlinks = OdxLinkDatabase() self.dop_bytes_termination_end_of_pdu = DataObjectProperty( odx_id=OdxLinkId("DOP_ID", doc_frags), + oid=None, short_name="DOP", long_name=None, description=None, @@ -2479,6 +2589,7 @@ def setUp(self) -> None: dop = self.dop_bytes_termination_end_of_pdu odxlinks.update(dop._build_odxlinks()) self.parameter_termination_end_of_pdu = ValueParameter( + oid=None, short_name="min_max_parameter", long_name=None, description=None, @@ -2492,6 +2603,7 @@ def setUp(self) -> None: ) self.parameter_sid = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2522,6 +2634,7 @@ def test_min_max_length_type_end_of_pdu(self) -> None: req_param2 = self.parameter_termination_end_of_pdu request = Request( odx_id=OdxLinkId("request", doc_frags), + oid=None, short_name="Request", long_name=None, description=None, @@ -2546,6 +2659,7 @@ def test_min_max_length_type_end_of_pdu_in_structure(self) -> None: structure = Structure( odx_id=OdxLinkId("structure_id", doc_frags), + oid=None, short_name="Structure_with_End_of_PDU_termination", long_name=None, description=None, @@ -2558,6 +2672,7 @@ def test_min_max_length_type_end_of_pdu_in_structure(self) -> None: req_param1 = self.parameter_sid req_param2 = ValueParameter( + oid=None, short_name="min_max_parameter", long_name=None, description=None, @@ -2572,6 +2687,7 @@ def test_min_max_length_type_end_of_pdu_in_structure(self) -> None: request = Request( odx_id=OdxLinkId("request", doc_frags), + oid=None, short_name="Request", long_name=None, description=None, @@ -2614,6 +2730,7 @@ def test_physical_constant_parameter(self) -> None: offset = 0x34 dop = DataObjectProperty( odx_id=OdxLinkId("DOP_ID", doc_frags), + oid=None, short_name="DOP", long_name=None, description=None, @@ -2652,6 +2769,7 @@ def test_physical_constant_parameter(self) -> None: ) odxlinks.update(dop._build_odxlinks()) req_param1 = CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -2663,6 +2781,7 @@ def test_physical_constant_parameter(self) -> None: sdgs=[], ) req_param2 = PhysicalConstantParameter( + oid=None, short_name="physical_constant_parameter", long_name=None, description=None, @@ -2676,6 +2795,7 @@ def test_physical_constant_parameter(self) -> None: ) request = Request( odx_id=OdxLinkId("request", doc_frags), + oid=None, short_name="Request", long_name=None, description=None, diff --git a/tests/test_diag_coded_types.py b/tests/test_diag_coded_types.py index c9958297..8c879c6c 100644 --- a/tests/test_diag_coded_types.py +++ b/tests/test_diag_coded_types.py @@ -202,6 +202,7 @@ def test_end_to_end(self) -> None: "certificateClient": DataObjectProperty( odx_id=OdxLinkId("BV.dummy_DL.DOP.certificateClient", doc_frags), + oid=None, short_name="certificateClient", long_name=None, description=None, @@ -220,6 +221,7 @@ def test_end_to_end(self) -> None: # Request request = Request( odx_id=OdxLinkId("BV.dummy_DL.RQ.sendCertificate", doc_frags), + oid=None, short_name="sendCertificate", long_name=None, description=None, @@ -227,6 +229,7 @@ def test_end_to_end(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -238,6 +241,7 @@ def test_end_to_end(self) -> None: sdgs=[], ), ValueParameter( + oid=None, short_name="certificateClient", long_name=None, description=Description.from_string("The certificate to verify."), @@ -258,6 +262,7 @@ def test_end_to_end(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("BV.dummy_DL", doc_frags), + oid=None, short_name="dummy_DL", long_name=None, description=None, @@ -378,6 +383,7 @@ def test_decode_param_info_length_type_uint(self) -> None: length_key_ref = OdxLinkRef.from_id(length_key_id) length_key = LengthKeyParameter( odx_id=length_key_id, + oid=None, short_name="length_key", long_name=None, description=None, @@ -410,6 +416,7 @@ def test_encode_param_info_length_type_uint(self) -> None: length_key_id = OdxLinkId("param.length_key", doc_frags) length_key = LengthKeyParameter( odx_id=length_key_id, + oid=None, short_name="length_key", long_name=None, description=None, @@ -497,6 +504,7 @@ def test_end_to_end(self) -> None: "uint8_times_8": DataObjectProperty( odx_id=OdxLinkId("BV.dummy_DL.DOP.uint8_times_8", doc_frags), + oid=None, short_name="uint8_times_8", long_name=None, description=None, @@ -513,6 +521,7 @@ def test_end_to_end(self) -> None: "certificateClient": DataObjectProperty( odx_id=OdxLinkId("BV.dummy_DL.DOP.certificateClient", doc_frags), + oid=None, short_name="certificateClient", long_name=None, description=None, @@ -531,6 +540,7 @@ def test_end_to_end(self) -> None: # Request using LengthKeyParameter and ParamLengthInfoType request = Request( odx_id=OdxLinkId("BV.dummy_DL.RQ.sendCertificate", doc_frags), + oid=None, short_name="sendCertificate", long_name=None, description=None, @@ -538,6 +548,7 @@ def test_end_to_end(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -555,6 +566,7 @@ def test_end_to_end(self) -> None: semantic=None, # LengthKeyParams have an ID to be referenced by a ParamLengthInfoType (which is a diag coded type) odx_id=OdxLinkId("param.dummy_length_key", doc_frags), + oid=None, byte_position=1, bit_position=None, # The DOP multiplies the coded value by 8, since the length key ref expects the number of bits. @@ -563,6 +575,7 @@ def test_end_to_end(self) -> None: sdgs=[], ), ValueParameter( + oid=None, short_name="certificateClient", long_name=None, description=Description.from_string("The certificate to verify."), @@ -583,6 +596,7 @@ def test_end_to_end(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.BASE_VARIANT, odx_id=OdxLinkId("BV.dummy_DL", doc_frags), + oid=None, short_name="dummy_DL", long_name=None, description=None, @@ -854,6 +868,7 @@ def test_end_to_end(self) -> None: "certificateClient": DataObjectProperty( odx_id=OdxLinkId("BV.dummy_DL.DOP.certificateClient", doc_frags), + oid=None, short_name="certificateClient", long_name=None, description=None, @@ -872,6 +887,7 @@ def test_end_to_end(self) -> None: # Request request = Request( odx_id=OdxLinkId("BV.dummy_DL.RQ.sendCertificate", doc_frags), + oid=None, short_name="sendCertificate", long_name=None, description=None, @@ -879,6 +895,7 @@ def test_end_to_end(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="SID", long_name=None, description=None, @@ -890,6 +907,7 @@ def test_end_to_end(self) -> None: sdgs=[], ), ValueParameter( + oid=None, short_name="certificateClient", long_name=None, description=Description.from_string("The certificate to verify."), @@ -903,6 +921,7 @@ def test_end_to_end(self) -> None: sdgs=[], ), CodedConstParameter( + oid=None, short_name="dummy", long_name=None, description=None, @@ -921,6 +940,7 @@ def test_end_to_end(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.BASE_VARIANT, odx_id=OdxLinkId("BV.dummy_DL", doc_frags), + oid=None, short_name="dummy_DL", long_name=None, description=None, diff --git a/tests/test_diag_data_dictionary_spec.py b/tests/test_diag_data_dictionary_spec.py index a58e235c..15587bdc 100644 --- a/tests/test_diag_data_dictionary_spec.py +++ b/tests/test_diag_data_dictionary_spec.py @@ -53,6 +53,7 @@ def test_initialization(self) -> None: dtc_dop = DtcDop( odx_id=OdxLinkId("test_ddds.dop.dtc_dop", doc_frags), + oid=None, short_name="dtc_dop", long_name=None, description=None, @@ -64,6 +65,7 @@ def test_initialization(self) -> None: dtcs_raw=[ DiagnosticTroubleCode( odx_id=OdxLinkId("test_ddds.dop.dtc_dop.DTC.X10", doc_frags), + oid=None, short_name="X10", long_name=None, description=None, @@ -81,6 +83,7 @@ def test_initialization(self) -> None: dop_1 = DataObjectProperty( odx_id=OdxLinkId("test_ddds.dop.the_dop", doc_frags), + oid=None, short_name="the_dop", long_name=None, description=None, @@ -96,6 +99,7 @@ def test_initialization(self) -> None: dop_2 = DataObjectProperty( odx_id=OdxLinkId("test_ddds.dop.another_dop", doc_frags), + oid=None, short_name="another_dop", long_name=None, description=None, @@ -113,6 +117,7 @@ def test_initialization(self) -> None: flip_quality_ref = OdxLinkRef.from_id(flip_quality_id) table = Table( odx_id=flip_quality_id, + oid=None, short_name="flip_quality", long_name="Flip Quality", description=None, @@ -124,6 +129,7 @@ def test_initialization(self) -> None: table_rows_raw=[ TableRow( odx_id=OdxLinkId("test_ddds.table.flip_quality.average", doc_frags), + oid=None, table_ref=flip_quality_ref, short_name="average", long_name="Average", @@ -138,6 +144,7 @@ def test_initialization(self) -> None: ), TableRow( odx_id=OdxLinkId("test_ddds.table.flip_quality.good", doc_frags), + oid=None, table_ref=flip_quality_ref, short_name="good", long_name="Good", @@ -152,6 +159,7 @@ def test_initialization(self) -> None: ), TableRow( odx_id=OdxLinkId("test_ddds.table.flip_quality.best", doc_frags), + oid=None, table_ref=flip_quality_ref, short_name="best", long_name="Best", @@ -170,6 +178,7 @@ def test_initialization(self) -> None: env_data = EnvironmentData( odx_id=OdxLinkId("test_ddds.env_data.flip_env_data", doc_frags), + oid=None, short_name="flip_env_data", long_name="Flip Env Data", description=None, @@ -177,6 +186,7 @@ def test_initialization(self) -> None: sdgs=[], parameters=NamedItemList([ ValueParameter( + oid=None, short_name="flip_speed", long_name="Flip Speed", description=None, @@ -189,6 +199,7 @@ def test_initialization(self) -> None: sdgs=[], ), PhysicalConstantParameter( + oid=None, short_name="flip_direction", long_name="Flip Direction", description=None, @@ -208,6 +219,7 @@ def test_initialization(self) -> None: env_data_desc = EnvironmentDataDescription( odx_id=OdxLinkId("test_ddds.env_data_desc.flip_env_data_desc", doc_frags), + oid=None, short_name="flip_env_data_desc", long_name="Flip Env Data Desc", description=None, @@ -221,6 +233,7 @@ def test_initialization(self) -> None: mux_case1_struct = Structure( odx_id=OdxLinkId("ddds_test.mux.case1.struct", doc_frags), + oid=None, short_name="mux_case1_struct", long_name=None, description=None, @@ -228,6 +241,7 @@ def test_initialization(self) -> None: sdgs=[], parameters=NamedItemList([ ValueParameter( + oid=None, short_name="min_donation", long_name=None, description=None, @@ -240,6 +254,7 @@ def test_initialization(self) -> None: sdgs=[], ), ValueParameter( + oid=None, short_name="min_surface_softness", long_name=None, description=None, @@ -257,6 +272,7 @@ def test_initialization(self) -> None: mux_case2_struct = Structure( odx_id=OdxLinkId("ddds_test.mux.case2.struct", doc_frags), + oid=None, short_name="mux_case2_struct", long_name=None, description=None, @@ -264,6 +280,7 @@ def test_initialization(self) -> None: sdgs=[], parameters=NamedItemList([ ValueParameter( + oid=None, short_name="min_temperature", long_name=None, description=None, @@ -281,6 +298,7 @@ def test_initialization(self) -> None: mux = Multiplexer( odx_id=OdxLinkId("test_ddds.multiplexer.flip_precondition", doc_frags), + oid=None, short_name="flip_precondition", long_name="Preconditions for doing flips", description=None, diff --git a/tests/test_ecu_variant_matching.py b/tests/test_ecu_variant_matching.py index b1f7dc88..9fa19099 100644 --- a/tests/test_ecu_variant_matching.py +++ b/tests/test_ecu_variant_matching.py @@ -27,6 +27,7 @@ def dummy_response(monkeypatch: pytest.MonkeyPatch) -> Response: resp = Response( odx_id=OdxLinkId(local_id="dummy_resp", doc_fragments=doc_frags), + oid=None, short_name="dummy_resp", long_name=None, description=None, @@ -52,6 +53,7 @@ def decode(message: bytes) -> Dict[str, Any]: def ident_service(monkeypatch: pytest.MonkeyPatch, dummy_response: Response) -> DiagService: dummy_req = Request( odx_id=OdxLinkId(local_id="dummy_req", doc_fragments=doc_frags), + oid=None, short_name="dummy_req", long_name=None, description=None, @@ -64,6 +66,7 @@ def ident_service(monkeypatch: pytest.MonkeyPatch, dummy_response: Response) -> diagService = DiagService( odx_id=OdxLinkId(local_id="identService", doc_fragments=doc_frags), + oid=None, short_name="identService", long_name=None, description=None, @@ -101,6 +104,7 @@ def encode_request() -> bytes: def supplier_service(monkeypatch: pytest.MonkeyPatch, dummy_response: Response) -> DiagService: dummy_req = Request( odx_id=OdxLinkId(local_id="dummy_req", doc_fragments=doc_frags), + oid=None, short_name="dummy_req", long_name=None, description=None, @@ -113,6 +117,7 @@ def supplier_service(monkeypatch: pytest.MonkeyPatch, dummy_response: Response) diagService = DiagService( odx_id=OdxLinkId(local_id="supplierService", doc_fragments=doc_frags), + oid=None, short_name="supplierService", long_name=None, description=None, @@ -198,6 +203,7 @@ def ecu_variant_1( raw_layer = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId(local_id="ecu_variant1", doc_fragments=doc_frags), + oid=None, short_name="ecu_variant1", long_name=None, description=None, @@ -238,6 +244,7 @@ def ecu_variant_2( raw_layer = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId(local_id="ecu_variant2", doc_fragments=doc_frags), + oid=None, short_name="ecu_variant2", long_name=None, description=None, @@ -279,6 +286,7 @@ def ecu_variant_3( raw_layer = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId(local_id="ecu_variant3", doc_fragments=doc_frags), + oid=None, short_name="ecu_variant3", long_name=None, description=None, diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 8d30a555..f4333007 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -49,6 +49,7 @@ def test_encode_coded_const_infer_order(self) -> None: is_condensed_raw=None, ) param1 = CodedConstParameter( + oid=None, short_name="coded_const_parameter", long_name=None, description=None, @@ -60,6 +61,7 @@ def test_encode_coded_const_infer_order(self) -> None: sdgs=[], ) param2 = CodedConstParameter( + oid=None, short_name="coded_const_parameter", long_name=None, description=None, @@ -72,6 +74,7 @@ def test_encode_coded_const_infer_order(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -92,6 +95,7 @@ def test_encode_coded_const_reorder(self) -> None: is_condensed_raw=None, ) param1 = CodedConstParameter( + oid=None, short_name="param1", long_name=None, description=None, @@ -103,6 +107,7 @@ def test_encode_coded_const_reorder(self) -> None: sdgs=[], ) param2 = CodedConstParameter( + oid=None, short_name="param2", long_name=None, description=None, @@ -115,6 +120,7 @@ def test_encode_coded_const_reorder(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -162,6 +168,7 @@ def test_encode_linear(self) -> None: physical_type=DataType.A_UINT32) dop = DataObjectProperty( odx_id=OdxLinkId("dop.id", doc_frags), + oid=None, short_name="dop_sn", long_name="example dop", description=None, @@ -176,6 +183,7 @@ def test_encode_linear(self) -> None: ) odxlinks.update({dop.odx_id: dop}) param1 = ValueParameter( + oid=None, short_name="value_parameter", long_name=None, description=None, @@ -189,6 +197,7 @@ def test_encode_linear(self) -> None: ) req = Request( odx_id=OdxLinkId("request.id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -222,6 +231,7 @@ def test_encode_nrc_const(self) -> None: ) dop = DataObjectProperty( odx_id=OdxLinkId("dop.id", doc_frags), + oid=None, short_name="dop_sn", long_name="example dop", description=None, @@ -240,6 +250,7 @@ def test_encode_nrc_const(self) -> None: physical_constr=None, ) param1 = CodedConstParameter( + oid=None, short_name="param1", long_name=None, description=None, @@ -251,6 +262,7 @@ def test_encode_nrc_const(self) -> None: sdgs=[], ) param2 = NrcConstParameter( + oid=None, short_name="param2", long_name=None, description=None, @@ -262,6 +274,7 @@ def test_encode_nrc_const(self) -> None: sdgs=[], ) param3 = ValueParameter( + oid=None, short_name="param3", long_name=None, description=None, @@ -275,6 +288,7 @@ def test_encode_nrc_const(self) -> None: ) resp = Response( odx_id=OdxLinkId("response_id", doc_frags), + oid=None, short_name="response_sn", long_name=None, description=None, @@ -287,6 +301,7 @@ def test_encode_nrc_const(self) -> None: req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -294,6 +309,7 @@ def test_encode_nrc_const(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="req_param1", long_name=None, description=None, @@ -310,6 +326,7 @@ def test_encode_nrc_const(self) -> None: service = DiagService( odx_id=OdxLinkId("service_id", doc_frags), + oid=None, short_name="service_sn", long_name=None, description=None, @@ -339,6 +356,7 @@ def test_encode_nrc_const(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("dl_id", doc_frags), + oid=None, short_name="dl_sn", long_name=None, description=None, @@ -403,6 +421,7 @@ def test_encode_env_data_desc(self) -> None: ) dop = DataObjectProperty( odx_id=OdxLinkId("dop.id", doc_frags), + oid=None, short_name="dop_sn", long_name="example dop", description=None, @@ -431,6 +450,7 @@ def test_encode_env_data_desc(self) -> None: ) dtc_dop = DtcDop( odx_id=OdxLinkId("dtcdop.id", doc_frags), + oid=None, short_name="dtcdop_sn", long_name=None, description=Description( @@ -451,6 +471,7 @@ def test_encode_env_data_desc(self) -> None: dtcs_raw=[ DiagnosticTroubleCode( odx_id=OdxLinkId("DTCs.first_trouble", doc_frags), + oid=None, short_name="first_trouble", long_name=None, description=None, @@ -462,6 +483,7 @@ def test_encode_env_data_desc(self) -> None: sdgs=[]), DiagnosticTroubleCode( odx_id=OdxLinkId("DTCs.follow_up_trouble", doc_frags), + oid=None, short_name="follow_up_trouble", long_name=None, description=None, @@ -473,6 +495,7 @@ def test_encode_env_data_desc(self) -> None: sdgs=[]), DiagnosticTroubleCode( odx_id=OdxLinkId("DTCs.screwed_up_hard", doc_frags), + oid=None, short_name="screwed_up_hard", long_name=None, description=None, @@ -489,6 +512,7 @@ def test_encode_env_data_desc(self) -> None: env_data_desc = EnvironmentDataDescription( odx_id=OdxLinkId("DTCs.trouble_explanation", doc_frags), + oid=None, short_name="trouble_explanation", long_name=None, description=None, @@ -499,6 +523,7 @@ def test_encode_env_data_desc(self) -> None: env_datas=[ EnvironmentData( odx_id=OdxLinkId("DTCs.trouble_explanation.boiler_plate", doc_frags), + oid=None, short_name="boiler_plate", long_name=None, description=None, @@ -509,6 +534,7 @@ def test_encode_env_data_desc(self) -> None: dtc_values=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="blabla_boiler", long_name=None, description=None, @@ -522,6 +548,7 @@ def test_encode_env_data_desc(self) -> None: ])), EnvironmentData( odx_id=OdxLinkId("DTCs.trouble_explanation.reason_for_1", doc_frags), + oid=None, short_name="reason_for_1", long_name=None, description=None, @@ -532,6 +559,7 @@ def test_encode_env_data_desc(self) -> None: dtc_values=[0x112233], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="blabla_1", long_name=None, description=None, @@ -545,6 +573,7 @@ def test_encode_env_data_desc(self) -> None: ])), EnvironmentData( odx_id=OdxLinkId("DTCs.trouble_explanation.reason_for_2", doc_frags), + oid=None, short_name="reason_for_2", long_name=None, description=None, @@ -555,6 +584,7 @@ def test_encode_env_data_desc(self) -> None: dtc_values=[0x445566], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="blabla_3", long_name=None, description=None, @@ -566,6 +596,7 @@ def test_encode_env_data_desc(self) -> None: sdgs=[], ), CodedConstParameter( + oid=None, short_name="blabla_2", long_name=None, description=None, @@ -582,6 +613,7 @@ def test_encode_env_data_desc(self) -> None: ) param1 = ValueParameter( + oid=None, short_name="DTC", long_name=None, description=None, @@ -594,6 +626,7 @@ def test_encode_env_data_desc(self) -> None: sdgs=[], ) param2 = ValueParameter( + oid=None, short_name="dtc_info", long_name=None, description=Description( @@ -609,6 +642,7 @@ def test_encode_env_data_desc(self) -> None: resp = Response( odx_id=OdxLinkId("DTCs.report_dtc.answer", doc_frags), + oid=None, short_name="report_dtc_answer", long_name=None, description=None, @@ -672,6 +706,7 @@ def test_encode_overlapping(self) -> None: is_condensed_raw=None, ) param1 = CodedConstParameter( + oid=None, short_name="code", long_name=None, description=None, @@ -683,6 +718,7 @@ def test_encode_overlapping(self) -> None: sdgs=[], ) param2 = CodedConstParameter( + oid=None, short_name="part1", long_name=None, description=None, @@ -694,6 +730,7 @@ def test_encode_overlapping(self) -> None: sdgs=[], ) param3 = CodedConstParameter( + oid=None, short_name="part2", long_name=None, description=None, @@ -706,6 +743,7 @@ def test_encode_overlapping(self) -> None: ) req = Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", long_name=None, description=None, @@ -720,6 +758,7 @@ def test_encode_overlapping(self) -> None: def _create_request(self, parameters: List[Parameter]) -> Request: return Request( odx_id=OdxLinkId("request_id", doc_frags), + oid=None, short_name="request_sn", parameters=NamedItemList(parameters), long_name=None, @@ -756,6 +795,7 @@ def test_bit_mask(self) -> None: inner_dop = DataObjectProperty( odx_id=OdxLinkId('dop.inner', doc_frags), + oid=None, short_name="inner_dop", long_name=None, description=None, @@ -770,6 +810,7 @@ def test_bit_mask(self) -> None: outer_dop = DataObjectProperty( odx_id=OdxLinkId('dop.outer', doc_frags), + oid=None, short_name="outer_dop", long_name=None, description=None, @@ -790,6 +831,7 @@ def test_bit_mask(self) -> None: # Inner inner_param = ValueParameter( + oid=None, short_name="inner_param", long_name=None, description=None, @@ -806,6 +848,7 @@ def test_bit_mask(self) -> None: # Outer outer_param = ValueParameter( + oid=None, short_name="outer_param", long_name=None, description=None, diff --git a/tests/test_singleecujob.py b/tests/test_singleecujob.py index 0f53d587..b7b54486 100644 --- a/tests/test_singleecujob.py +++ b/tests/test_singleecujob.py @@ -65,18 +65,21 @@ class Context(NamedTuple): self.context = Context( extensiveTask=FunctionalClass( odx_id=OdxLinkId("ID.extensiveTask", doc_frags), + oid=None, short_name="extensiveTask", long_name=None, description=None, ), specialAudience=AdditionalAudience( odx_id=OdxLinkId("ID.specialAudience", doc_frags), + oid=None, short_name="specialAudience", long_name=None, description=None, ), inputDOP=DataObjectProperty( odx_id=OdxLinkId("ID.inputDOP", doc_frags), + oid=None, short_name="inputDOP", long_name=None, description=None, @@ -135,6 +138,7 @@ class Context(NamedTuple): ), outputDOP=DataObjectProperty( odx_id=OdxLinkId("ID.outputDOP", doc_frags), + oid=None, short_name="outputDOP", long_name=None, description=None, @@ -180,6 +184,7 @@ class Context(NamedTuple): ), negOutputDOP=DataObjectProperty( odx_id=OdxLinkId("ID.negOutputDOP", doc_frags), + oid=None, short_name="negOutputDOP", long_name=None, description=None, @@ -259,6 +264,7 @@ class Context(NamedTuple): self.singleecujob_object = SingleEcuJob( odx_id=OdxLinkId("ID.JumpStart", doc_frags), + oid=None, short_name="JumpStart", long_name=None, description=None, @@ -366,6 +372,7 @@ def test_write_odx(self) -> None: jinja_env.globals["odxraise"] = jinja2_odxraise_helper jinja_env.globals["make_xml_attrib"] = make_xml_attrib jinja_env.globals["make_bool_xml_attrib"] = make_bool_xml_attrib + jinja_env.globals["getattr"] = getattr jinja_env.globals["hasattr"] = hasattr # Small template @@ -393,6 +400,7 @@ def test_default_lists(self) -> None: """Test that empty lists are assigned to list-attributes if no explicit value is passed.""" sej = SingleEcuJob( odx_id=OdxLinkId("ID.SomeID", doc_frags), + oid=None, short_name="SN.SomeShortName", long_name=None, description=None, @@ -433,6 +441,7 @@ def test_resolve_odxlinks(self) -> None: ecu_variant_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("ID.bv", doc_frags), + oid=None, short_name="bv", long_name=None, description=None, diff --git a/tests/test_unit_spec.py b/tests/test_unit_spec.py index 3edaca28..f0293754 100644 --- a/tests/test_unit_spec.py +++ b/tests/test_unit_spec.py @@ -111,6 +111,7 @@ def test_resolve_odxlinks(self) -> None: ) dop = DataObjectProperty( odx_id=OdxLinkId("dop_id", doc_frags), + oid=None, short_name="dop_sn", admin_data=None, long_name=None, @@ -131,6 +132,7 @@ def test_resolve_odxlinks(self) -> None: dl_raw = EcuVariantRaw( variant_type=DiagLayerType.ECU_VARIANT, odx_id=OdxLinkId("BV_id", doc_frags), + oid=None, short_name="BaseVariant", long_name=None, description=None, @@ -162,6 +164,7 @@ def test_resolve_odxlinks(self) -> None: requests=NamedItemList([ Request( odx_id=OdxLinkId("rq_id", doc_frags), + oid=None, short_name="rq_sn", admin_data=None, long_name=None, @@ -169,6 +172,7 @@ def test_resolve_odxlinks(self) -> None: sdgs=[], parameters=NamedItemList([ CodedConstParameter( + oid=None, short_name="sid", long_name=None, description=None, @@ -180,6 +184,7 @@ def test_resolve_odxlinks(self) -> None: sdgs=[], ), ValueParameter( + oid=None, short_name="time", long_name=None, description=None,