From c1e138cb4730ab68abe0fbf4fe8d4bf265238b0f Mon Sep 17 00:00:00 2001 From: Henrik Wahlqvist Date: Tue, 24 Sep 2024 14:11:04 +0200 Subject: [PATCH] Add option for softwareComponentBase This setting changes the ASIL classification of the software component by adding the swcbase key to the yaml file. ZC projects only. Change-Id: Ic94dbb3cb4ca617f4637066d50ee0817e1e923cc --- powertrain_build/build_proj_config.py | 4 ++++ powertrain_build/zone_controller/composition_yaml.py | 3 +++ .../zone_controller/test_composition_yaml/composition_yaml.py | 2 ++ .../composition_yaml_with_a2l_axis_data.py | 1 + .../composition_yaml_with_calls_all_fields.py | 1 + .../composition_yaml_with_calls_no_optional_fields.py | 1 + .../test_composition_yaml/composition_yaml_with_dids.py | 1 + .../test_composition_yaml/composition_yaml_with_dtcs.py | 1 + tests/zone_controller/test_composition_yaml.py | 1 + 9 files changed, 15 insertions(+) diff --git a/powertrain_build/build_proj_config.py b/powertrain_build/build_proj_config.py index b727429..c0a3f54 100644 --- a/powertrain_build/build_proj_config.py +++ b/powertrain_build/build_proj_config.py @@ -276,6 +276,10 @@ class BuildProjConfig: """Returns the software component template to use.""" return self._prj_cfg['ProjectInfo'].get('softwareComponentTemplate') + def get_swc_base(self): + """Returns the software component base to use (ASIL classification).""" + return self._prj_cfg['ProjectInfo'].get('softwareComponentBase', 'QM') + def get_car_com_dst(self): """Return the absolute path to the source output folder.""" return os.path.join(self.get_root_dir(), diff --git a/powertrain_build/zone_controller/composition_yaml.py b/powertrain_build/zone_controller/composition_yaml.py index 2cc8bb4..a5a80ef 100644 --- a/powertrain_build/zone_controller/composition_yaml.py +++ b/powertrain_build/zone_controller/composition_yaml.py @@ -396,6 +396,7 @@ class CompositionYaml(ProblemLogger): """ software_component_name = self.build_cfg.get_swc_name() software_component_template = self.build_cfg.get_swc_template() + software_component_base = self.build_cfg.get_swc_base() data_types = { **self.cal_class_info["autosar"]["data_types"], **self.meas_class_info["autosar"]["data_types"], @@ -404,6 +405,8 @@ class CompositionYaml(ProblemLogger): swcs[software_component_name]["type"] = "SWC" # Other types than swc?? if software_component_template is not None: swcs[software_component_name]["template"] = software_component_template + if software_component_base is not None: + swcs[software_component_name]["swcbase"] = software_component_base swcs[software_component_name]["runnables"] = self._get_runnable_info() swcs[software_component_name]["shared"] = self.cal_class_info["autosar"]["class_info"] swcs[software_component_name]["static"] = self.meas_class_info["autosar"]["class_info"] diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml.py b/test_data/zone_controller/test_composition_yaml/composition_yaml.py index c76a324..c5ef79e 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml.py @@ -10,6 +10,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", @@ -39,6 +40,7 @@ expected_cal_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_a2l_axis_data.py b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_a2l_axis_data.py index 4f6f809..ac4e4b5 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_a2l_axis_data.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_a2l_axis_data.py @@ -151,6 +151,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_all_fields.py b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_all_fields.py index d2aa516..27210c0 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_all_fields.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_all_fields.py @@ -10,6 +10,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_no_optional_fields.py b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_no_optional_fields.py index a0c98ce..804bd1d 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_no_optional_fields.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_calls_no_optional_fields.py @@ -10,6 +10,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dids.py b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dids.py index b37ae62..bc56ff0 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dids.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dids.py @@ -42,6 +42,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dtcs.py b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dtcs.py index 56cbcbb..823c6cf 100644 --- a/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dtcs.py +++ b/test_data/zone_controller/test_composition_yaml/composition_yaml_with_dtcs.py @@ -33,6 +33,7 @@ expected_result = { "testName_SC": { "type": "SWC", "template": "ARTCSC", + "swcbase": "QM", "runnables": { "AR_prefix_VcExtINI": { "type": "INIT", diff --git a/tests/zone_controller/test_composition_yaml.py b/tests/zone_controller/test_composition_yaml.py index 9eedd20..2cd45f3 100644 --- a/tests/zone_controller/test_composition_yaml.py +++ b/tests/zone_controller/test_composition_yaml.py @@ -50,6 +50,7 @@ class TestCompositionYaml(unittest.TestCase): self.build_cfg.get_composition_name = MagicMock(return_value="compositionName") self.build_cfg.get_swc_name = MagicMock(return_value="testName_SC") self.build_cfg.get_swc_template = MagicMock(return_value="ARTCSC") + self.build_cfg.get_swc_base = MagicMock(return_value="QM") self.build_cfg.get_gen_ext_impl_type = MagicMock(return_value=True) self.build_cfg.get_code_generation_config = MagicMock(return_value=False)