armodel 1.5.0__py3-none-any.whl → 1.6.1__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/arxml_dump_cli.py +13 -13
- armodel/cli/memory_section_cli.py +76 -0
- armodel/cli/system_signal_cli.py +74 -0
- armodel/data_models/sw_connector.py +3 -3
- armodel/lib/__init__.py +2 -1
- armodel/lib/system_signal.py +37 -0
- armodel/models/__init__.py +9 -4
- armodel/models/annotation.py +27 -3
- armodel/models/ar_object.py +18 -6
- armodel/models/ar_package.py +271 -127
- armodel/models/ar_ref.py +11 -166
- armodel/models/bsw_module_template.py +37 -14
- armodel/models/common_structure.py +91 -174
- armodel/models/communication.py +2 -2
- armodel/models/data_prototype.py +41 -6
- armodel/models/datatype.py +16 -74
- armodel/models/end_to_end_protection.py +1 -1
- armodel/models/fibex/can_communication.py +119 -3
- armodel/models/fibex/fibex_4_can/__init__.py +0 -0
- armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
- armodel/models/fibex/fibex_4_multiplatform.py +81 -88
- armodel/models/fibex/fibex_core/__init__.py +0 -0
- armodel/models/fibex/fibex_core/core_communication.py +627 -0
- armodel/models/fibex/fibex_core/core_topology.py +180 -0
- armodel/models/fibex/lin_communication.py +24 -3
- armodel/models/general_structure.py +110 -11
- armodel/models/internal_behavior.py +1 -1
- armodel/models/m2/__init__.py +0 -0
- armodel/models/m2/autosar_templates/__init__.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
- armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/implementation.py +21 -0
- armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +148 -0
- armodel/models/m2/autosar_templates/ecuc_description_template.py +269 -0
- armodel/models/m2/autosar_templates/generic_structure/__init__.py +0 -0
- armodel/models/m2/autosar_templates/generic_structure/abstract_structure.py +69 -0
- armodel/models/m2/autosar_templates/sw_component_template/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/communication.py +360 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +246 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +181 -0
- armodel/models/m2/autosar_templates/sw_component_template/composition/__init__.py +154 -0
- armodel/models/m2/autosar_templates/sw_component_template/composition/instance_refs.py +157 -0
- armodel/models/m2/autosar_templates/sw_component_template/data_type/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/data_type/data_prototypes.py +104 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface/__init__.py +243 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface/instance_refs.py +39 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface.py +236 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +46 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/instance_refs_usage.py +169 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +38 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +27 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
- armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
- armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
- armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
- armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
- armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
- armodel/models/m2/msr/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/units.py +105 -0
- armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
- armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
- armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
- armodel/models/m2/msr/documentation/__init__.py +0 -0
- armodel/models/m2/msr/documentation/block_elements.py +18 -0
- armodel/models/m2_msr.py +1 -0
- armodel/models/multilanguage_data.py +15 -0
- armodel/models/per_instance_memory.py +34 -6
- armodel/models/port_prototype.py +2 -253
- armodel/models/service_needs.py +3 -1
- armodel/models/sw_component.py +19 -358
- armodel/parser/__init__.py +2 -1
- armodel/parser/abstract_arxml_parser.py +10 -1
- armodel/parser/arxml_parser.py +912 -229
- armodel/parser/file_parser.py +43 -0
- armodel/tests/test_armodel/models/test_ar_package.py +6 -3
- armodel/tests/test_armodel/models/test_ar_ref.py +18 -16
- armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
- armodel/tests/test_armodel/models/test_common_structure.py +8 -7
- armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +9 -9
- armodel/tests/test_armodel/models/test_port_interface.py +2 -2
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -3
- armodel/tests/test_armodel/parser/test_sw_components.py +3 -3
- armodel/writer/abstract_arxml_writer.py +5 -1
- armodel/writer/arxml_writer.py +870 -224
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/METADATA +28 -1
- armodel-1.6.1.dist-info/RECORD +140 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +3 -1
- armodel-1.5.0.dist-info/RECORD +0 -91
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class FileListParser:
|
|
8
|
+
'''
|
|
9
|
+
FileListParser supports to collect the arxml files from the following rules
|
|
10
|
+
|
|
11
|
+
'''
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self.file_list = []
|
|
14
|
+
self.logger = logging.getLogger()
|
|
15
|
+
|
|
16
|
+
def get_file_list(self) -> List[str]:
|
|
17
|
+
return self.file_list
|
|
18
|
+
|
|
19
|
+
def parse_text_file(self, file):
|
|
20
|
+
try:
|
|
21
|
+
with open(file) as f_in:
|
|
22
|
+
for line in f_in:
|
|
23
|
+
self.file_list.append(line.strip())
|
|
24
|
+
except:
|
|
25
|
+
self.logger.error("No such file or directory: %s" % os.path.realpath(file))
|
|
26
|
+
|
|
27
|
+
def parse_dir_files(self, dir_name):
|
|
28
|
+
for (root, _, files) in os.walk(dir_name, topdown=False):
|
|
29
|
+
for file in files:
|
|
30
|
+
m = re.match(r'.*\.arxml$', file, re.I)
|
|
31
|
+
if m:
|
|
32
|
+
self.file_list.append(os.path.join(root, file))
|
|
33
|
+
|
|
34
|
+
def parse(self, args: List[str]):
|
|
35
|
+
for input_file in args:
|
|
36
|
+
if os.path.isdir(input_file):
|
|
37
|
+
self.parse_dir_files(input_file)
|
|
38
|
+
else:
|
|
39
|
+
if input_file[0] == "@":
|
|
40
|
+
logging.debug("Parse ARXML list file %s " % input_file)
|
|
41
|
+
self.parse_text_file(input_file[1:])
|
|
42
|
+
else:
|
|
43
|
+
self.file_list.append(input_file)
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
""" Test AR Package """
|
|
2
2
|
import pytest
|
|
3
3
|
|
|
4
|
+
from ....models.m2.autosar_templates.common_structure.implementation_data_types import ImplementationDataType
|
|
5
|
+
from ....models.m2.autosar_templates.sw_component_template.components import SwComponentType
|
|
4
6
|
from ....models.ar_package import AUTOSAR
|
|
5
|
-
from ....models.datatype import ApplicationPrimitiveDataType, ApplicationRecordDataType, DataTypeMappingSet,
|
|
7
|
+
from ....models.datatype import ApplicationPrimitiveDataType, ApplicationRecordDataType, DataTypeMappingSet, SwBaseType
|
|
6
8
|
from ....models.general_structure import ARElement, ARObject, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable
|
|
7
9
|
from ....models.m2_msr import CompuMethod
|
|
8
|
-
from ....models.port_interface import ClientServerInterface, DataInterface, PortInterface, SenderReceiverInterface
|
|
9
|
-
from ....models.sw_component import ApplicationSwComponentType, AtomicSwComponentType,
|
|
10
|
+
from ....models.m2.autosar_templates.sw_component_template.port_interface import ClientServerInterface, DataInterface, PortInterface, SenderReceiverInterface
|
|
11
|
+
from ....models.sw_component import ApplicationSwComponentType, AtomicSwComponentType, EcuAbstractionSwComponentType, ServiceSwComponentType
|
|
12
|
+
from ....models.m2.autosar_templates.sw_component_template.composition import CompositionSwComponentType
|
|
10
13
|
|
|
11
14
|
class TestAUTOSAR:
|
|
12
15
|
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
|
-
from ....models.
|
|
6
|
-
from ....models.
|
|
5
|
+
from ....models.m2.autosar_templates.generic_structure.abstract_structure import AtpInstanceRef
|
|
6
|
+
from ....models.m2.autosar_templates.sw_component_template.composition.instance_refs import OperationInAtomicSwcInstanceRef, POperationInAtomicSwcInstanceRef, PPortInCompositionInstanceRef, ROperationInAtomicSwcInstanceRef, RPortInCompositionInstanceRef
|
|
7
|
+
from ....models.m2.autosar_templates.sw_component_template.swc_internal_behavior.instance_refs_usage import ArVariableInImplementationDataInstanceRef, AutosarVariableRef
|
|
8
|
+
from ....models.ar_ref import RefType, TRefType
|
|
7
9
|
from ....models.general_structure import ARObject
|
|
8
10
|
|
|
9
11
|
|
|
@@ -21,9 +23,9 @@ class TestARRef:
|
|
|
21
23
|
def test_AutosarVariableRef(self):
|
|
22
24
|
ref_type = AutosarVariableRef()
|
|
23
25
|
assert(ref_type != None)
|
|
24
|
-
assert(ref_type.
|
|
25
|
-
assert(ref_type.
|
|
26
|
-
assert(ref_type.
|
|
26
|
+
assert(ref_type.autosarVariableIRef == None)
|
|
27
|
+
assert(ref_type.autosarVariableInImplDatatype == None)
|
|
28
|
+
assert(ref_type.localVariableRef == None)
|
|
27
29
|
|
|
28
30
|
def test_AtpInstanceRef(self):
|
|
29
31
|
with pytest.raises(NotImplementedError) as err:
|
|
@@ -33,24 +35,24 @@ class TestARRef:
|
|
|
33
35
|
def test_ProvidedPortPrototypeInstanceRef(self):
|
|
34
36
|
ref_type = PPortInCompositionInstanceRef()
|
|
35
37
|
assert(ref_type != None)
|
|
36
|
-
assert(ref_type.
|
|
37
|
-
assert(ref_type.
|
|
38
|
+
assert(ref_type.getContextComponentRef() == None)
|
|
39
|
+
assert(ref_type.getTargetPPortRef() == None)
|
|
38
40
|
|
|
39
41
|
def test_RequiredPortPrototypeInstanceRef(self):
|
|
40
42
|
ref_type = RPortInCompositionInstanceRef()
|
|
41
43
|
assert(ref_type != None)
|
|
42
|
-
assert(ref_type.
|
|
43
|
-
assert(ref_type.
|
|
44
|
+
assert(ref_type.getContextComponentRef() == None)
|
|
45
|
+
assert(ref_type.getTargetRPortRef() == None)
|
|
44
46
|
|
|
45
47
|
def test_ArVariableInImplementationDataInstanceRef(self):
|
|
46
48
|
ref_type = ArVariableInImplementationDataInstanceRef()
|
|
47
49
|
assert(ref_type != None)
|
|
48
|
-
assert(ref_type.
|
|
49
|
-
assert(ref_type.
|
|
50
|
+
assert(ref_type.getPortPrototypeRef() == None)
|
|
51
|
+
assert(ref_type.getTargetDataPrototypeRef() == None)
|
|
50
52
|
|
|
51
53
|
def test_OperationInAtomicSwcInstanceRef(self):
|
|
52
54
|
with pytest.raises(NotImplementedError) as err:
|
|
53
|
-
|
|
55
|
+
_ = OperationInAtomicSwcInstanceRef()
|
|
54
56
|
assert(str(err.value) == "OperationInAtomicSwcInstanceRef is an abstract class.")
|
|
55
57
|
|
|
56
58
|
def test_POperationInAtomicSwcInstanceRef(self):
|
|
@@ -60,8 +62,8 @@ class TestARRef:
|
|
|
60
62
|
assert(isinstance(ref_type, OperationInAtomicSwcInstanceRef))
|
|
61
63
|
assert(isinstance(ref_type, POperationInAtomicSwcInstanceRef))
|
|
62
64
|
assert(ref_type != None)
|
|
63
|
-
assert(ref_type.
|
|
64
|
-
assert(ref_type.
|
|
65
|
+
assert(ref_type.getContextPPortRef() == None)
|
|
66
|
+
assert(ref_type.getTargetProvidedOperationRef() == None)
|
|
65
67
|
|
|
66
68
|
def test_ROperationInAtomicSwcInstanceRef(self):
|
|
67
69
|
ref_type = ROperationInAtomicSwcInstanceRef()
|
|
@@ -70,5 +72,5 @@ class TestARRef:
|
|
|
70
72
|
assert(isinstance(ref_type, OperationInAtomicSwcInstanceRef))
|
|
71
73
|
assert(isinstance(ref_type, ROperationInAtomicSwcInstanceRef))
|
|
72
74
|
assert(ref_type != None)
|
|
73
|
-
assert(ref_type.
|
|
74
|
-
assert(ref_type.
|
|
75
|
+
assert(ref_type.getContextRPortRef() == None)
|
|
76
|
+
assert(ref_type.getTargetRequiredOperationRef() == None)
|
|
@@ -15,12 +15,12 @@ class TestBswModuleDescription:
|
|
|
15
15
|
document = AUTOSAR.getInstance()
|
|
16
16
|
ar_root = document.createARPackage("AUTOSAR")
|
|
17
17
|
bsw_module_description = BswModuleDescription(ar_root, "bsw_module")
|
|
18
|
-
with pytest.raises(ValueError) as err:
|
|
19
|
-
|
|
20
|
-
assert(str(err.value) == "Invalid category <invalid> of BswModuleDescription <bsw_module>")
|
|
18
|
+
#with pytest.raises(ValueError) as err:
|
|
19
|
+
# bsw_module_description.category = "invalid"
|
|
20
|
+
#assert(str(err.value) == "Invalid category <invalid> of BswModuleDescription <bsw_module>")
|
|
21
21
|
|
|
22
|
-
bsw_module_description.
|
|
23
|
-
assert(bsw_module_description.
|
|
22
|
+
bsw_module_description.setCategory("BSW_MODULE")
|
|
23
|
+
assert(bsw_module_description.getCategory() == "BSW_MODULE")
|
|
24
24
|
|
|
25
25
|
class Test_M2_AUTOSARTemplates_BswModuleTemplate_BswInterfaces:
|
|
26
26
|
def test_BswModuleEntry(self):
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
|
+
from ....models.m2.autosar_templates.common_structure.implementation_data_types import AbstractImplementationDataTypeElement, ImplementationDataTypeElement
|
|
3
4
|
from .... import AUTOSAR
|
|
4
|
-
from ....models.common_structure import
|
|
5
|
-
from ....models.
|
|
5
|
+
from ....models.m2.autosar_templates.common_structure import ConstantReference, ConstantSpecification, ValueSpecification
|
|
6
|
+
from ....models.common_structure import ExecutableEntity
|
|
6
7
|
from ....models.general_structure import ARElement, ARObject, CollectableElement, Identifiable
|
|
7
8
|
from ....models.general_structure import MultilanguageReferrable, PackageableElement, Referrable
|
|
8
9
|
|
|
@@ -30,7 +31,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_Constants:
|
|
|
30
31
|
def test_ConstantReference(self):
|
|
31
32
|
ref = ConstantReference()
|
|
32
33
|
|
|
33
|
-
assert(ref.
|
|
34
|
+
assert(ref.getConstantRef() == None)
|
|
34
35
|
|
|
35
36
|
assert(isinstance(ref, ARObject))
|
|
36
37
|
assert(isinstance(ref, ValueSpecification))
|
|
@@ -50,9 +51,9 @@ class Test_M2_AUTOSARTemplates_CommonStructure_ImplementationDataTypes:
|
|
|
50
51
|
ar_root = document.createARPackage("AUTOSAR")
|
|
51
52
|
data_type = ImplementationDataTypeElement(ar_root, "implementation_data_type")
|
|
52
53
|
|
|
53
|
-
assert(data_type.
|
|
54
|
-
assert(data_type.
|
|
55
|
-
assert(data_type.
|
|
54
|
+
assert(data_type.getShortName() == "implementation_data_type")
|
|
55
|
+
assert(data_type.getArraySize() == None)
|
|
56
|
+
assert(data_type.getIsOptional() == None)
|
|
56
57
|
|
|
57
58
|
assert(isinstance(data_type, ARObject))
|
|
58
59
|
assert(isinstance(data_type, AbstractImplementationDataTypeElement))
|
|
@@ -65,7 +66,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_ImplementationDataTypes:
|
|
|
65
66
|
assert(isinstance(data_type, ImplementationDataTypeElement))
|
|
66
67
|
|
|
67
68
|
sub_type = data_type.createImplementationDataTypeElement("sub_type")
|
|
68
|
-
assert(sub_type.
|
|
69
|
+
assert(sub_type.getShortName() == "sub_type")
|
|
69
70
|
assert(isinstance(sub_type, ImplementationDataTypeElement))
|
|
70
71
|
|
|
71
72
|
assert(len(data_type.getImplementationDataTypeElements()) == 1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
|
-
from ....models.data_dictionary import SwDataDefProps, SwPointerTargetProps
|
|
3
|
+
from ....models.m2.msr.data_dictionary.data_def_properties import SwDataDefProps, SwPointerTargetProps
|
|
4
4
|
from ....models.general_structure import ARObject
|
|
5
5
|
|
|
6
6
|
class Test_M2_MSR_DataDictionary_DataDefProperties:
|
|
@@ -16,7 +16,7 @@ class Test_M2_MSR_DataDictionary_DataDefProperties:
|
|
|
16
16
|
assert(props.implementationDataTypeRef == None)
|
|
17
17
|
assert(props.swImplPolicy == None)
|
|
18
18
|
assert(props.swCalibrationAccess == None)
|
|
19
|
-
assert(props.
|
|
19
|
+
assert(props.swPointerTargetProps == None)
|
|
20
20
|
|
|
21
21
|
def test_SwPointerTargetProps(self):
|
|
22
22
|
props = SwPointerTargetProps()
|
|
@@ -24,6 +24,6 @@ class Test_M2_MSR_DataDictionary_DataDefProperties:
|
|
|
24
24
|
assert(isinstance(props, ARObject))
|
|
25
25
|
assert(isinstance(props, SwPointerTargetProps))
|
|
26
26
|
|
|
27
|
-
assert(props.
|
|
28
|
-
assert(props.
|
|
29
|
-
assert(props.
|
|
27
|
+
assert(props.getFunctionPointerSignatureRef() == None)
|
|
28
|
+
assert(props.getSwDataDefProps() == None)
|
|
29
|
+
assert(props.getTargetCategory() == None)
|
|
@@ -2,7 +2,7 @@ import pytest
|
|
|
2
2
|
|
|
3
3
|
from .... import AUTOSAR
|
|
4
4
|
from ....models.ar_ref import RefType
|
|
5
|
-
from ....models.
|
|
5
|
+
from ....models.m2.autosar_templates.sw_component_template.data_type.data_prototypes import ApplicationArrayElement, ApplicationCompositeElementDataPrototype, ApplicationRecordElement, AtpPrototype, AutosarDataPrototype, DataPrototype, VariableDataPrototype
|
|
6
6
|
from ....models.general_structure import ARObject, AtpFeature, Identifiable, MultilanguageReferrable, Referrable
|
|
7
7
|
|
|
8
8
|
class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_DataPrototypes:
|
|
@@ -44,7 +44,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_DataPrototypes:
|
|
|
44
44
|
|
|
45
45
|
assert(prototype._parent == ar_root)
|
|
46
46
|
assert(prototype.short_name == "prototype")
|
|
47
|
-
assert(prototype.
|
|
47
|
+
assert(prototype.typeTRef is None)
|
|
48
48
|
|
|
49
49
|
def test_ApplicationCompositeElementDataPrototype(self):
|
|
50
50
|
with pytest.raises(NotImplementedError) as err:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
|
-
from .... import
|
|
4
|
-
from ....models import
|
|
5
|
-
from ....models.common_structure import
|
|
6
|
-
from ....models.
|
|
7
|
-
from ....models.datatype import
|
|
3
|
+
from ....models.m2.autosar_templates.common_structure.implementation_data_types import AbstractImplementationDataType, ImplementationDataType, ImplementationDataTypeElement
|
|
4
|
+
from ....models.m2.autosar_templates.sw_component_template.components import SymbolProps
|
|
5
|
+
from ....models.m2.autosar_templates.common_structure.implementation import ImplementationProps
|
|
6
|
+
from ....models.m2.autosar_templates.sw_component_template.data_type.data_prototypes import ApplicationRecordElement
|
|
7
|
+
from ....models.datatype import ApplicationArrayDataType, ApplicationCompositeDataType, ApplicationDataType, ApplicationPrimitiveDataType, ApplicationRecordDataType, AtpType, AutosarDataType, BaseType, DataTypeMap, DataTypeMappingSet
|
|
8
8
|
from ....models.datatype import BaseTypeDirectDefinition, SwBaseType
|
|
9
9
|
from ....models.general_structure import ARElement, ARObject, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable
|
|
10
|
-
|
|
10
|
+
from .... import AUTOSAR
|
|
11
11
|
class Test_M2_AUTOSARTemplates_CommonStructure_Implementation:
|
|
12
12
|
def test_ImplementationProps(self):
|
|
13
13
|
with pytest.raises(NotImplementedError) as err:
|
|
@@ -28,7 +28,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_Implementation:
|
|
|
28
28
|
|
|
29
29
|
assert(prototype._parent == ar_root)
|
|
30
30
|
assert(prototype.short_name == "SymbolProps")
|
|
31
|
-
assert(prototype.symbol ==
|
|
31
|
+
assert(prototype.symbol == None)
|
|
32
32
|
|
|
33
33
|
class Test_M2_MSR_AsamHdo_BaseTypes:
|
|
34
34
|
def test_BaseType(self):
|
|
@@ -99,7 +99,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_Datatypes:
|
|
|
99
99
|
|
|
100
100
|
assert(data_type._parent == ar_root)
|
|
101
101
|
assert(data_type.short_name == "ApplicationPrimitiveDataType")
|
|
102
|
-
assert(data_type.
|
|
102
|
+
assert(data_type.swDataDefProps == None)
|
|
103
103
|
|
|
104
104
|
def test_ApplicationCompositeDataType(self):
|
|
105
105
|
with pytest.raises(NotImplementedError) as err:
|
|
@@ -227,7 +227,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_ImplementationDataTypes:
|
|
|
227
227
|
assert(data_type._parent == ar_root)
|
|
228
228
|
assert(data_type.short_name == "ImplementationDataType")
|
|
229
229
|
assert(data_type.sub_elements == [])
|
|
230
|
-
assert(data_type.
|
|
230
|
+
assert(data_type.symbolProps == None)
|
|
231
231
|
assert(data_type._type_emitter == None)
|
|
232
232
|
|
|
233
233
|
element = data_type.createImplementationDataTypeElement("ImplementationDataTypeElement")
|
|
@@ -2,10 +2,10 @@ import pytest
|
|
|
2
2
|
|
|
3
3
|
from ....models.ar_package import AUTOSAR
|
|
4
4
|
from ....models.ar_ref import RefType
|
|
5
|
-
from ....models.
|
|
5
|
+
from ....models.m2.autosar_templates.sw_component_template.data_type.data_prototypes import AtpPrototype, AutosarDataPrototype, DataPrototype, VariableDataPrototype
|
|
6
6
|
from ....models.datatype import AtpType
|
|
7
7
|
from ....models.general_structure import ARElement, ARObject, AtpFeature, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable
|
|
8
|
-
from ....models.port_interface import ApplicationError, ArgumentDataPrototype, ClientServerInterface, ClientServerOperation, DataInterface, NvDataInterface, ParameterInterface, PortInterface, SenderReceiverInterface
|
|
8
|
+
from ....models.m2.autosar_templates.sw_component_template.port_interface import ApplicationError, ArgumentDataPrototype, ClientServerInterface, ClientServerOperation, DataInterface, NvDataInterface, ParameterInterface, PortInterface, SenderReceiverInterface
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
@@ -72,13 +72,13 @@ class TestBswMD:
|
|
|
72
72
|
assert(len(behavior.getBswSchedulableEntities()) == 1)
|
|
73
73
|
entity = behavior.getBswSchedulableEntities()[0]
|
|
74
74
|
assert(entity.short_name == "BswM_MainFunction")
|
|
75
|
-
assert(entity.
|
|
75
|
+
assert(entity.minimumStartInterval is not None)
|
|
76
76
|
assert(entity.minimumStartIntervalMs is not None)
|
|
77
77
|
assert(len(entity.getCanEnterExclusiveAreaRefs()) == 1)
|
|
78
78
|
assert(entity.getCanEnterExclusiveAreaRefs()[0].dest == "EXCLUSIVE-AREA")
|
|
79
79
|
assert(entity.getCanEnterExclusiveAreaRefs()[0].value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
|
|
80
|
-
assert(entity.
|
|
81
|
-
assert(entity.
|
|
80
|
+
assert(entity.implementedEntryRef.dest == "BSW-MODULE-ENTRY")
|
|
81
|
+
assert(entity.implementedEntryRef.value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
82
82
|
|
|
83
83
|
assert(len(behavior.getBswTimingEvents()) == 1)
|
|
84
84
|
event = behavior.getBswTimingEvents()[0]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import filecmp
|
|
2
|
-
from ....models.
|
|
2
|
+
from ....models.m2.autosar_templates.sw_component_template.composition import CompositionSwComponentType
|
|
3
3
|
from ....writer.arxml_writer import ARXMLWriter
|
|
4
4
|
from ....parser.arxml_parser import ARXMLParser
|
|
5
5
|
from ....models.ar_package import AUTOSAR
|
|
@@ -13,10 +13,10 @@ class TestSWComponents:
|
|
|
13
13
|
|
|
14
14
|
def test_ar_packages(self):
|
|
15
15
|
document = AUTOSAR.getInstance()
|
|
16
|
-
root_pkgs = sorted(document.getARPackages(), key = lambda pkg: pkg.
|
|
16
|
+
root_pkgs = sorted(document.getARPackages(), key = lambda pkg: pkg.getShortName())
|
|
17
17
|
|
|
18
18
|
assert(len(root_pkgs) == 1)
|
|
19
|
-
assert("DemoApplication" == root_pkgs[0].
|
|
19
|
+
assert("DemoApplication" == root_pkgs[0].getShortName())
|
|
20
20
|
|
|
21
21
|
def test_composition_sw_component_types(self):
|
|
22
22
|
document = AUTOSAR.getInstance()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from abc import ABCMeta
|
|
2
3
|
import re
|
|
3
4
|
from xml.dom import minidom
|
|
@@ -111,7 +112,10 @@ class AbstractARXMLWriter:
|
|
|
111
112
|
return xml
|
|
112
113
|
|
|
113
114
|
def saveToFile(self, filename, root: ET.Element):
|
|
114
|
-
|
|
115
|
+
if sys.version_info <= (3,9):
|
|
116
|
+
xml = ET.tostring(root, encoding = "UTF-8", short_empty_elements = False)
|
|
117
|
+
else:
|
|
118
|
+
xml = ET.tostring(root, encoding = "UTF-8", xml_declaration = True, short_empty_elements = False)
|
|
115
119
|
|
|
116
120
|
dom = minidom.parseString(xml.decode())
|
|
117
121
|
xml = dom.toprettyxml(indent = " ", encoding = "UTF-8")
|