armodel 1.3.0__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armodel/cli/connector2xlsx_cli.py +75 -0
- armodel/cli/connector_update_cli.py +70 -0
- armodel/cli/swc_list_cli.py +2 -2
- armodel/lib/__init__.py +1 -1
- armodel/lib/data_analyzer.py +1 -1
- armodel/lib/sw_component.py +34 -0
- armodel/models/__init__.py +6 -1
- armodel/models/ar_object.py +39 -0
- armodel/models/ar_package.py +35 -1
- armodel/models/ar_ref.py +12 -2
- armodel/models/bsw_module_template.py +3 -2
- armodel/models/calibration.py +16 -0
- armodel/models/common_structure.py +92 -0
- armodel/models/communication.py +8 -0
- armodel/models/datatype.py +23 -5
- armodel/models/general_structure.py +48 -3
- armodel/models/global_constraints.py +40 -0
- armodel/models/m2_msr.py +76 -2
- armodel/models/port_prototype.py +21 -16
- armodel/models/sw_component.py +47 -18
- armodel/models/unit.py +14 -0
- armodel/parser/arxml_parser.py +552 -120
- armodel/parser/excel_parser.py +0 -0
- armodel/report/__init__.py +1 -0
- armodel/report/connector_xls_report.py +76 -0
- armodel/report/excel_report.py +42 -0
- armodel/tests/__init__.py +0 -0
- armodel/tests/test_armodel/__init__.py +0 -0
- armodel/tests/test_armodel/models/__init__.py +0 -0
- armodel/tests/test_armodel/models/test_ar_package.py +294 -0
- armodel/tests/test_armodel/models/test_ar_ref.py +74 -0
- armodel/tests/test_armodel/models/test_bsw_module_template.py +46 -0
- armodel/tests/test_armodel/models/test_common_structure.py +73 -0
- armodel/tests/test_armodel/models/test_data_dictionary.py +29 -0
- armodel/tests/test_armodel/models/test_data_prototype.py +86 -0
- armodel/tests/test_armodel/models/test_datatype.py +239 -0
- armodel/tests/test_armodel/models/test_general_structure.py +50 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +77 -0
- armodel/tests/test_armodel/models/test_port_interface.py +198 -0
- armodel/tests/test_armodel/models/test_port_prototype.py +14 -0
- armodel/tests/test_armodel/parser/__init__.py +0 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +168 -0
- armodel/writer/__init__.py +1 -0
- armodel/writer/arxml_writer.py +641 -0
- {armodel-1.3.0.dist-info → armodel-1.4.0.dist-info}/METADATA +38 -5
- armodel-1.4.0.dist-info/RECORD +60 -0
- {armodel-1.3.0.dist-info → armodel-1.4.0.dist-info}/WHEEL +1 -1
- armodel-1.4.0.dist-info/entry_points.txt +5 -0
- armodel-1.3.0.dist-info/RECORD +0 -31
- armodel-1.3.0.dist-info/entry_points.txt +0 -4
- {armodel-1.3.0.dist-info → armodel-1.4.0.dist-info}/LICENSE +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
from .... import AUTOSAR, ARPackage
|
|
2
|
+
from .... import ARXMLParser
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
class TestBswMD:
|
|
7
|
+
def setup_method(self):
|
|
8
|
+
logging.basicConfig(format='[%(levelname)s] : %(message)s', level = logging.DEBUG)
|
|
9
|
+
|
|
10
|
+
document = AUTOSAR.getInstance()
|
|
11
|
+
document.clear()
|
|
12
|
+
parser = ARXMLParser()
|
|
13
|
+
parser.load("src/armodel/tests/test_files/BswM_Bswmd.arxml", document)
|
|
14
|
+
|
|
15
|
+
def test_ar_packages(self):
|
|
16
|
+
document = AUTOSAR.getInstance()
|
|
17
|
+
root_pkgs = sorted(document.getARPackages(), key = lambda pkg: pkg.short_name)
|
|
18
|
+
assert(len(root_pkgs) == 2)
|
|
19
|
+
assert(root_pkgs[0].short_name == "AUTOSAR_BswM")
|
|
20
|
+
assert(root_pkgs[1].short_name == "EB_BswM_TxDxM1I14R0")
|
|
21
|
+
|
|
22
|
+
root_pkg_0_pkgs = sorted(root_pkgs[0].getARPackages(), key = lambda pkg: pkg.short_name)
|
|
23
|
+
assert(len(root_pkg_0_pkgs) == 3)
|
|
24
|
+
|
|
25
|
+
bsw_module_desc_pkg = root_pkg_0_pkgs[0] # type:ARPackage
|
|
26
|
+
assert(bsw_module_desc_pkg.short_name == "BswModuleDescriptions")
|
|
27
|
+
|
|
28
|
+
root_pkg_1_pkgs = root_pkgs[1].getARPackages()
|
|
29
|
+
assert(len(root_pkg_1_pkgs) == 1)
|
|
30
|
+
|
|
31
|
+
def test_bsw_module_description(self):
|
|
32
|
+
document = AUTOSAR.getInstance()
|
|
33
|
+
|
|
34
|
+
pkg = document.find("/AUTOSAR_BswM/BswModuleDescriptions") # type: ARPackage
|
|
35
|
+
bsw_module_descs = pkg.getBswModuleDescriptions()
|
|
36
|
+
assert(len(bsw_module_descs) == 1)
|
|
37
|
+
|
|
38
|
+
bsw_module_desc = bsw_module_descs[0]
|
|
39
|
+
assert(bsw_module_desc.short_name == "BswM")
|
|
40
|
+
assert(bsw_module_desc.module_id == 42)
|
|
41
|
+
|
|
42
|
+
# verify the provided entries
|
|
43
|
+
assert(len(bsw_module_desc.implemented_entry_refs) == 2)
|
|
44
|
+
assert(bsw_module_desc.implemented_entry_refs[0].dest == "BSW-MODULE-ENTRY")
|
|
45
|
+
assert(bsw_module_desc.implemented_entry_refs[0].value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
46
|
+
assert(bsw_module_desc.implemented_entry_refs[1].dest == "BSW-MODULE-ENTRY")
|
|
47
|
+
assert(bsw_module_desc.implemented_entry_refs[1].value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_Init")
|
|
48
|
+
|
|
49
|
+
assert(len(bsw_module_desc.getBswInternalBehaviors()) == 1)
|
|
50
|
+
behavior = bsw_module_desc.getBswInternalBehaviors()[0]
|
|
51
|
+
assert(behavior.short_name == "InternalBehavior_0")
|
|
52
|
+
|
|
53
|
+
assert(len(behavior.getDataTypeMappingRefs()) == 1)
|
|
54
|
+
data_type_mapping_ref = behavior.getDataTypeMappingRefs()[0]
|
|
55
|
+
assert(data_type_mapping_ref.dest == "DATA-TYPE-MAPPING-SET")
|
|
56
|
+
assert(data_type_mapping_ref.value == "/BswMMode/DataTypeMappingSets/BswMModeMapping")
|
|
57
|
+
|
|
58
|
+
assert(len(behavior.getExclusiveAreas()) == 1)
|
|
59
|
+
assert(behavior.getExclusiveAreas()[0].short_name == "SCHM_BSWM_EXCLUSIVE_AREA")
|
|
60
|
+
|
|
61
|
+
assert(len(behavior.getBswSchedulableEntities()) == 1)
|
|
62
|
+
entity = behavior.getBswSchedulableEntities()[0]
|
|
63
|
+
assert(entity.short_name == "BswM_MainFunction")
|
|
64
|
+
assert(entity.minimum_start_interval == 0)
|
|
65
|
+
assert(entity.minimum_start_interval_ms == 0)
|
|
66
|
+
assert(len(entity.getCanEnterExclusiveAreaRefs()) == 1)
|
|
67
|
+
assert(entity.getCanEnterExclusiveAreaRefs()[0].dest == "EXCLUSIVE-AREA")
|
|
68
|
+
assert(entity.getCanEnterExclusiveAreaRefs()[0].value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
|
|
69
|
+
assert(entity.implemented_entry_ref.dest == "BSW-MODULE-ENTRY")
|
|
70
|
+
assert(entity.implemented_entry_ref.value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
71
|
+
|
|
72
|
+
assert(len(behavior.getBswTimingEvents()) == 1)
|
|
73
|
+
event = behavior.getBswTimingEvents()[0]
|
|
74
|
+
assert(event.short_name == "TimingEvent_MainFunction")
|
|
75
|
+
assert(event.starts_on_event_ref.dest == "BSW-SCHEDULABLE-ENTITY")
|
|
76
|
+
assert(event.starts_on_event_ref.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
77
|
+
assert(event.period == 0.02)
|
|
78
|
+
assert(event.period_ms == 20)
|
|
79
|
+
|
|
80
|
+
def test_bsw_module_entries(self):
|
|
81
|
+
document = AUTOSAR.getInstance()
|
|
82
|
+
|
|
83
|
+
pkg = document.find("/AUTOSAR_BswM/BswModuleEntrys") # type: ARPackage
|
|
84
|
+
entries = sorted(pkg.getBswModuleEntries(), key= lambda entry: entry.short_name)
|
|
85
|
+
assert(len(entries) == 2)
|
|
86
|
+
|
|
87
|
+
assert(entries[0].short_name == "BswM_Init")
|
|
88
|
+
assert(entries[0].service_id == 0)
|
|
89
|
+
assert(entries[0].is_reentrant.value == False)
|
|
90
|
+
assert(entries[0].is_synchronous.value == True)
|
|
91
|
+
assert(entries[0].call_type == "REGULAR")
|
|
92
|
+
assert(entries[0].execution_context == "UNSPECIFIED")
|
|
93
|
+
assert(entries[0].sw_service_impl_policy == "STANDARD")
|
|
94
|
+
|
|
95
|
+
assert(entries[1].short_name == "BswM_MainFunction")
|
|
96
|
+
assert(entries[1].service_id == 3)
|
|
97
|
+
assert(entries[1].is_reentrant.value == False)
|
|
98
|
+
assert(entries[1].is_synchronous.value == True)
|
|
99
|
+
assert(entries[1].call_type == "SCHEDULED")
|
|
100
|
+
assert(entries[1].execution_context == "TASK")
|
|
101
|
+
assert(entries[1].sw_service_impl_policy == "STANDARD")
|
|
102
|
+
|
|
103
|
+
def test_bsw_module_swc_bsw_mapping(self):
|
|
104
|
+
document = AUTOSAR.getInstance()
|
|
105
|
+
|
|
106
|
+
pkg = document.find("/AUTOSAR_BswM/SwcBswMappings") # type: ARPackage
|
|
107
|
+
mappings = pkg.getSwcBswMappings()
|
|
108
|
+
assert(len(mappings) == 1)
|
|
109
|
+
|
|
110
|
+
assert(mappings[0].bsw_behavior_ref.dest == "BSW-INTERNAL-BEHAVIOR")
|
|
111
|
+
assert(mappings[0].bsw_behavior_ref.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
112
|
+
|
|
113
|
+
assert(len(mappings[0].getRunnableMappings()) == 1)
|
|
114
|
+
runnable_mapping = mappings[0].getRunnableMappings()[0]
|
|
115
|
+
assert(runnable_mapping.bsw_entity_ref.dest == "BSW-SCHEDULABLE-ENTITY")
|
|
116
|
+
assert(runnable_mapping.bsw_entity_ref.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
117
|
+
assert(runnable_mapping.swc_runnable_ref.dest == "RUNNABLE-ENTITY")
|
|
118
|
+
assert(runnable_mapping.swc_runnable_ref.value == "/AUTOSAR_BswM/SwComponentTypes/BswM/BswMInternalBehavior/RES_MainFunction")
|
|
119
|
+
|
|
120
|
+
def test_bsw_module_implementation(self):
|
|
121
|
+
document = AUTOSAR.getInstance()
|
|
122
|
+
|
|
123
|
+
pkg = document.find("/EB_BswM_TxDxM1I14R0/Implementations") # type: ARPackage
|
|
124
|
+
assert(len(pkg.getBswImplementations()) == 1)
|
|
125
|
+
impl = pkg.getBswImplementations()[0]
|
|
126
|
+
assert(impl.short_name == "BswImplementation_0")
|
|
127
|
+
assert(len(impl.getCodeDescriptors()) == 1)
|
|
128
|
+
|
|
129
|
+
code_desc = impl.getCodeDescriptors()[0]
|
|
130
|
+
assert(code_desc.short_name == "Files")
|
|
131
|
+
assert(len(code_desc.getArtifactDescriptors()) == 21)
|
|
132
|
+
assert(len(code_desc.getArtifactDescriptors("SWSRC")) == 4)
|
|
133
|
+
assert(len(code_desc.getArtifactDescriptors("SWHDR")) == 15)
|
|
134
|
+
assert(len(code_desc.getArtifactDescriptors("SWMAKE")) == 2)
|
|
135
|
+
|
|
136
|
+
artifact_descs = sorted(code_desc.getArtifactDescriptors("SWMAKE"), key= lambda o: o.short_label)
|
|
137
|
+
assert(artifact_descs[0].short_label == "make::BswM_defs.mak")
|
|
138
|
+
assert(artifact_descs[0].category == "SWMAKE")
|
|
139
|
+
assert(artifact_descs[1].short_label == "make::BswM_rules.mak")
|
|
140
|
+
assert(artifact_descs[1].category == "SWMAKE")
|
|
141
|
+
|
|
142
|
+
assert(impl.programming_language == "C")
|
|
143
|
+
|
|
144
|
+
assert(impl.resource_consumption.short_name == "ResourceConsumption")
|
|
145
|
+
assert(len(impl.resource_consumption.getMemorySections()) == 8)
|
|
146
|
+
|
|
147
|
+
section = impl.resource_consumption.getMemorySection("CODE")
|
|
148
|
+
assert(section.short_name == "CODE")
|
|
149
|
+
assert(section.alignment == None)
|
|
150
|
+
assert(section.sw_addr_method_ref.dest == "SW-ADDR-METHOD")
|
|
151
|
+
assert(section.sw_addr_method_ref.value == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
|
|
152
|
+
|
|
153
|
+
section = impl.resource_consumption.getMemorySection("VAR_NO_INIT_UNSPECIFIED")
|
|
154
|
+
assert(section.short_name == "VAR_NO_INIT_UNSPECIFIED")
|
|
155
|
+
assert(section.alignment == "UNSPECIFIED")
|
|
156
|
+
assert(section.sw_addr_method_ref.dest == "SW-ADDR-METHOD")
|
|
157
|
+
assert(section.sw_addr_method_ref.value == "/AUTOSAR_MemMap/SwAddrMethods/VAR_NOINIT")
|
|
158
|
+
|
|
159
|
+
assert(impl.vendor_id == 1)
|
|
160
|
+
assert(impl.sw_version == "1.14.1")
|
|
161
|
+
assert(impl.swc_bsw_mapping_ref.dest == "SWC-BSW-MAPPING")
|
|
162
|
+
assert(impl.swc_bsw_mapping_ref.value == "/AUTOSAR_BswM/SwcBswMappings/SwcBswMapping_0")
|
|
163
|
+
assert(impl.ar_release_version == "4.0.3")
|
|
164
|
+
assert(impl.behavior_ref.dest == "BSW-INTERNAL-BEHAVIOR")
|
|
165
|
+
assert(impl.behavior_ref.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .arxml_writer import ARXMLWriter
|