armodel 1.6.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/data_models/sw_connector.py +3 -3
- armodel/models/__init__.py +4 -2
- armodel/models/ar_object.py +1 -1
- armodel/models/ar_package.py +185 -151
- armodel/models/ar_ref.py +0 -202
- armodel/models/common_structure.py +3 -71
- armodel/models/communication.py +1 -1
- armodel/models/datatype.py +5 -69
- armodel/models/end_to_end_protection.py +1 -1
- armodel/models/general_structure.py +10 -4
- armodel/models/internal_behavior.py +1 -1
- 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 +2 -1
- 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/communication.py +44 -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 +33 -1
- 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/swc_internal_behavior/data_elements.py +3 -11
- 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 +1 -2
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +5 -4
- armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
- armodel/models/m2_msr.py +1 -0
- armodel/models/port_prototype.py +1 -90
- armodel/models/service_needs.py +3 -1
- armodel/models/sw_component.py +6 -143
- armodel/parser/__init__.py +2 -1
- armodel/parser/arxml_parser.py +124 -58
- armodel/parser/file_parser.py +43 -0
- armodel/tests/test_armodel/models/test_ar_package.py +5 -2
- armodel/tests/test_armodel/models/test_ar_ref.py +15 -13
- armodel/tests/test_armodel/models/test_common_structure.py +6 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
- armodel/tests/test_armodel/models/test_datatype.py +8 -8
- armodel/tests/test_armodel/models/test_port_interface.py +1 -1
- armodel/tests/test_armodel/parser/test_sw_components.py +1 -1
- armodel/writer/abstract_arxml_writer.py +5 -1
- armodel/writer/arxml_writer.py +68 -58
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/METADATA +5 -1
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/RECORD +52 -39
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
armodel/parser/arxml_parser.py
CHANGED
|
@@ -2,15 +2,25 @@ from typing import List
|
|
|
2
2
|
import xml.etree.ElementTree as ET
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
|
+
from ..models.ar_ref import RefType
|
|
6
|
+
from ..models.m2.autosar_templates.common_structure.implementation import ImplementationProps
|
|
5
7
|
from ..models.m2.autosar_templates.common_structure import ApplicationValueSpecification, ArrayValueSpecification, ConstantReference, NumericalValueSpecification, RecordValueSpecification, TextValueSpecification, ValueSpecification
|
|
6
|
-
from ..models.m2.autosar_templates.
|
|
8
|
+
from ..models.m2.autosar_templates.generic_structure.abstract_structure import AnyInstanceRef
|
|
9
|
+
from ..models.m2.autosar_templates.sw_component_template.composition.instance_refs import POperationInAtomicSwcInstanceRef, PPortInCompositionInstanceRef, ROperationInAtomicSwcInstanceRef, RPortInCompositionInstanceRef
|
|
10
|
+
from ..models.m2.autosar_templates.sw_component_template.port_interface.instance_refs import ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
11
|
+
from ..models.m2.autosar_templates.sw_component_template.swc_internal_behavior.instance_refs_usage import AutosarParameterRef, AutosarVariableRef, VariableInAtomicSWCTypeInstanceRef
|
|
12
|
+
from ..models.m2.autosar_templates.system_template.instance_refs import VariableDataPrototypeInSystemInstanceRef
|
|
13
|
+
from ..models.m2.autosar_templates.sw_component_template.components.instance_refs import InnerPortGroupInCompositionInstanceRef, PModeGroupInAtomicSwcInstanceRef, RModeGroupInAtomicSWCInstanceRef
|
|
7
14
|
from ..models.m2.autosar_templates.sw_component_template.swc_internal_behavior import RunnableEntityArgument
|
|
8
|
-
from ..models.m2.
|
|
15
|
+
from ..models.m2.autosar_templates.sw_component_template.components import PortGroup, SwComponentType, SymbolProps, PPortPrototype, RPortPrototype
|
|
16
|
+
from ..models.m2.autosar_templates.sw_component_template.composition import AssemblySwConnector, CompositionSwComponentType, DelegationSwConnector
|
|
17
|
+
|
|
9
18
|
from ..models.m2.autosar_templates.sw_component_template.swc_internal_behavior.mode_declaration_group import ModeAccessPoint, ModeSwitchPoint
|
|
10
19
|
from ..models.m2.autosar_templates.sw_component_template.swc_internal_behavior.server_call import ServerCallPoint
|
|
11
|
-
from ..models.m2.autosar_templates.sw_component_template.communication import ClientComSpec, ModeSwitchSenderComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, QueuedSenderComSpec, ReceiverComSpec, SenderComSpec, ServerComSpec
|
|
20
|
+
from ..models.m2.autosar_templates.sw_component_template.communication import ClientComSpec, ModeSwitchSenderComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, ParameterRequireComSpec, QueuedSenderComSpec, ReceiverComSpec, SenderComSpec, ServerComSpec
|
|
12
21
|
from ..models.fibex.lin_communication import LinFrameTriggering
|
|
13
22
|
from ..models.fibex.fibex_core.core_topology import AbstractCanCluster, CanPhysicalChannel, CommunicationCluster, LinPhysicalChannel, PhysicalChannel
|
|
23
|
+
from ..models.m2.msr.data_dictionary.data_def_properties import SwDataDefProps
|
|
14
24
|
from ..models.m2.msr.documentation.block_elements import DocumentationBlock
|
|
15
25
|
from ..models.m2.autosar_templates.system_template import System, SystemMapping
|
|
16
26
|
from ..models.m2.autosar_templates.system_template.data_mapping import SenderReceiverToSignalGroupMapping, SenderReceiverToSignalMapping
|
|
@@ -22,7 +32,7 @@ from ..models.fibex.fibex_core.core_communication import Frame, FrameTriggering,
|
|
|
22
32
|
from ..models.internal_behavior import IncludedDataTypeSet
|
|
23
33
|
from ..models.timing import ExecutionOrderConstraint, TimingExtension
|
|
24
34
|
from ..models.bsw_module_template import BswModeSenderPolicy
|
|
25
|
-
from ..models.m2.autosar_templates.sw_component_template.port_interface import InvalidationPolicy, ModeSwitchInterface, PortInterface
|
|
35
|
+
from ..models.m2.autosar_templates.sw_component_template.port_interface import InvalidationPolicy, ModeSwitchInterface, ParameterInterface, PortInterface
|
|
26
36
|
from ..models.common_structure import IncludedModeDeclarationGroupSet, MemorySection, ModeDeclarationGroup, ModeDeclarationGroupPrototype, ModeRequestTypeMap
|
|
27
37
|
from ..models.implementation import BswImplementation, EngineeringObject
|
|
28
38
|
from ..models.general_structure import MultilanguageReferrable
|
|
@@ -37,22 +47,18 @@ from ..models.service_mapping import RoleBasedPortAssignment
|
|
|
37
47
|
from ..models.ar_package import AUTOSAR, ARPackage
|
|
38
48
|
from ..models.ar_object import ARLiteral
|
|
39
49
|
from ..models.service_needs import RoleBasedDataAssignment
|
|
40
|
-
from ..models.
|
|
41
|
-
from ..models.
|
|
42
|
-
from ..models.data_prototype import ApplicationCompositeElementDataPrototype, AutosarDataPrototype, DataPrototype, ParameterDataPrototype, VariableDataPrototype
|
|
50
|
+
from ..models.sw_component import AtomicSwComponentType, PortAPIOption, PortDefinedArgumentValue, ServiceDependency, SwcServiceDependency
|
|
51
|
+
from ..models.m2.autosar_templates.sw_component_template.data_type.data_prototypes import ApplicationCompositeElementDataPrototype, AutosarDataPrototype, DataPrototype, ParameterDataPrototype, VariableDataPrototype
|
|
43
52
|
from ..models.port_prototype import ModeSwitchReceiverComSpec, QueuedReceiverComSpec
|
|
44
53
|
from ..models.annotation import Annotation, GeneralAnnotation
|
|
45
54
|
from ..models.global_constraints import InternalConstrs, DataConstr, DataConstrRule, PhysConstrs
|
|
46
55
|
|
|
47
56
|
from ..models import SwcInternalBehavior, RunnableEntity, RTEEvent, OperationInvokedEvent, DataReceivedEvent, RVariableInAtomicSwcInstanceRef
|
|
48
57
|
from ..models import SwcModeSwitchEvent, RModeInAtomicSwcInstanceRef
|
|
49
|
-
|
|
50
|
-
from ..models import ImplementationDataType, SwPointerTargetProps, DataTypeMappingSet, DataTypeMap
|
|
51
|
-
from ..models import RPortPrototype, PPortPrototype
|
|
58
|
+
|
|
59
|
+
from ..models import ImplementationDataType, SwPointerTargetProps, DataTypeMappingSet, DataTypeMap
|
|
52
60
|
from ..models import SenderReceiverInterface, ClientServerInterface, ClientServerOperation, ArgumentDataPrototype
|
|
53
61
|
from ..models import Identifiable, AdminData, Sdg, Sd
|
|
54
|
-
from ..models import AssemblySwConnector, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
55
|
-
from ..models import DelegationSwConnector
|
|
56
62
|
from ..models import CompuMethod, CompuScale, CompuScales, Compu, CompuConst, CompuConstTextContent, CompuScaleConstantContents, CompuScaleRationalFormula, CompuRationalCoeffs, CompuNominatorDenominator
|
|
57
63
|
from ..models import InternalBehavior, ExecutableEntity
|
|
58
64
|
from ..models import Implementation, Code, AutosarEngineeringObject, ResourceConsumption
|
|
@@ -547,7 +553,7 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
547
553
|
short_name = self.getShortName(child_element)
|
|
548
554
|
memory_section = consumption.createMemorySection(short_name)
|
|
549
555
|
self.readIdentifiable(child_element, memory_section)
|
|
550
|
-
memory_section.
|
|
556
|
+
memory_section.setAlignment(self.getChildElementOptionalLiteral(child_element, "ALIGNMENT"))
|
|
551
557
|
self.readMemorySectionOptions(child_element, memory_section)
|
|
552
558
|
memory_section.size = self.getChildElementOptionalNumericalValue(child_element, "SIZE")
|
|
553
559
|
memory_section.swAddrMethodRef = self.getChildElementOptionalRefType(child_element, "SW-ADDRMETHOD-REF")
|
|
@@ -1057,16 +1063,26 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1057
1063
|
self.readAutosarDataType(element, data_type)
|
|
1058
1064
|
self.readImplementationDataTypeElements(element, data_type)
|
|
1059
1065
|
data_type.setTypeEmitter(self.getChildElementOptionalLiteral(element, "TYPE-EMITTER"))
|
|
1060
|
-
if (data_type.
|
|
1066
|
+
if (data_type.getCategory().getValue() == ImplementationDataType.CATEGORY_ARRAY):
|
|
1061
1067
|
if (len(data_type.getImplementationDataTypeElements()) < 1):
|
|
1062
1068
|
self._raiseError("Array Sub-Element of <%s> do not defined." % data_type.short_name)
|
|
1069
|
+
|
|
1063
1070
|
array_sub_element = data_type.getImplementationDataTypeElements()[0]
|
|
1064
|
-
if (array_sub_element.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
1071
|
+
if (array_sub_element.category.getValue() == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
1065
1072
|
data_type.setArrayElementType(array_sub_element.swDataDefProps.implementationDataTypeRef.value)
|
|
1066
|
-
elif (array_sub_element.category == ImplementationDataType.CATEGORY_TYPE_VALUE): # TODO: fix
|
|
1073
|
+
elif (array_sub_element.category.getValue() == ImplementationDataType.CATEGORY_TYPE_VALUE): # TODO: fix
|
|
1067
1074
|
return
|
|
1068
1075
|
else:
|
|
1069
|
-
self._raiseError("The category <%s> of array sub-element <%s> does not support." % (array_sub_element.category, data_type.short_name))
|
|
1076
|
+
self._raiseError("The category <%s> of array sub-element <%s> does not support." % (array_sub_element.category.value, data_type.short_name))
|
|
1077
|
+
elif (data_type.getCategory().getValue() == ImplementationDataType.CATEGORY_TYPE_STRUCTURE):
|
|
1078
|
+
if (len(data_type.getImplementationDataTypeElements()) < 1):
|
|
1079
|
+
self._raiseError("Structure Sub-Element of <%s> do not defined." % data_type.short_name)
|
|
1080
|
+
self.readImplementationDataTypeSymbolProps(element, data_type)
|
|
1081
|
+
struct_sub_element = data_type.getImplementationDataTypeElements()[0]
|
|
1082
|
+
if (struct_sub_element.getCategory().getValue() == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
1083
|
+
data_type.setStructElementType(struct_sub_element.getSwDataDefProps().getImplementationDataTypeRef().getValue())
|
|
1084
|
+
else:
|
|
1085
|
+
self._raiseError("The category <%s> of structure sub-element <%s> does not support." % (struct_sub_element.category.value, data_type.short_name))
|
|
1070
1086
|
|
|
1071
1087
|
def readBaseTypeDirectDefinition(self, element: ET.Element, definition: BaseTypeDirectDefinition):
|
|
1072
1088
|
definition.base_type_size = self.getChildElementOptionalNumericalValue(element, "BASE-TYPE-SIZE")
|
|
@@ -1085,8 +1101,8 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1085
1101
|
iref = None
|
|
1086
1102
|
if child_element is not None:
|
|
1087
1103
|
iref = ApplicationCompositeElementInPortInterfaceInstanceRef()
|
|
1088
|
-
iref.
|
|
1089
|
-
|
|
1104
|
+
iref.setRootDataPrototypeRef(self.getChildElementOptionalRefType(child_element, "ROOT-DATA-PROTOTYPE-REF"))\
|
|
1105
|
+
.setTargetDataPrototypeRef(self.getChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF"))
|
|
1090
1106
|
return iref
|
|
1091
1107
|
|
|
1092
1108
|
def getCompositeNetworkRepresentation(self, element: ET.Element) -> CompositeNetworkRepresentation:
|
|
@@ -1096,9 +1112,9 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1096
1112
|
representation.network_representation = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION")
|
|
1097
1113
|
return representation
|
|
1098
1114
|
|
|
1099
|
-
def readReceiverComSpec(self, element, com_spec: ReceiverComSpec):
|
|
1115
|
+
def readReceiverComSpec(self, element: ET.Element, com_spec: ReceiverComSpec):
|
|
1100
1116
|
self.readElementAttributes(element, com_spec)
|
|
1101
|
-
for child_element in
|
|
1117
|
+
for child_element in self.findall(element, "COMPOSITE-NETWORK-REPRESENTATIONS/COMPOSITE-NETWORK-REPRESENTATION"):
|
|
1102
1118
|
com_spec.addCompositeNetworkRepresentation(self.getCompositeNetworkRepresentation(child_element))
|
|
1103
1119
|
com_spec.dataElementRef = self.getChildElementOptionalRefType(element, "DATA-ELEMENT-REF")
|
|
1104
1120
|
com_spec.networkRepresentation = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION")
|
|
@@ -1159,6 +1175,13 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1159
1175
|
com_spec.operationRef = self.getChildElementOptionalRefType(element, "OPERATION-REF")
|
|
1160
1176
|
return com_spec
|
|
1161
1177
|
|
|
1178
|
+
def getParameterRequireComSpec(self, element: ET.Element) -> ParameterRequireComSpec:
|
|
1179
|
+
com_spec = ParameterRequireComSpec()
|
|
1180
|
+
self.readElementAttributes(element, com_spec)
|
|
1181
|
+
com_spec.setInitValue(self.getInitValue(element)) \
|
|
1182
|
+
.setParameterRef(self.getChildElementOptionalRefType(element, "PARAMETER-REF"))
|
|
1183
|
+
return com_spec
|
|
1184
|
+
|
|
1162
1185
|
def getQueuedReceiverComSpec(self, element: ET.Element) -> QueuedReceiverComSpec:
|
|
1163
1186
|
com_spec = QueuedReceiverComSpec()
|
|
1164
1187
|
self.readElementAttributes(element, com_spec)
|
|
@@ -1194,6 +1217,8 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1194
1217
|
parent.addRequiredComSpec(self.getQueuedReceiverComSpec(child_element))
|
|
1195
1218
|
elif tag_name == "MODE-SWITCH-RECEIVER-COM-SPEC":
|
|
1196
1219
|
parent.addRequiredComSpec(self.getModeSwitchReceiverComSpec(child_element))
|
|
1220
|
+
elif tag_name == "PARAMETER-REQUIRE-COM-SPEC":
|
|
1221
|
+
parent.addRequiredComSpec(self.getParameterRequireComSpec(child_element))
|
|
1197
1222
|
else:
|
|
1198
1223
|
self._raiseError("Unsupported RequiredComSpec <%s>" % tag_name)
|
|
1199
1224
|
|
|
@@ -1202,12 +1227,12 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1202
1227
|
self.logger.debug("readRPortPrototype %s" % short_name)
|
|
1203
1228
|
prototype = parent.createRPortPrototype(short_name)
|
|
1204
1229
|
self.readIdentifiable(element, prototype)
|
|
1205
|
-
prototype.
|
|
1230
|
+
prototype.setRequiredInterfaceTRef(self.getChildElementOptionalRefType(element, "REQUIRED-INTERFACE-TREF"))
|
|
1206
1231
|
|
|
1207
1232
|
self.readRequiredComSpec(element, prototype)
|
|
1208
1233
|
|
|
1209
1234
|
def readAtomicSwComponentTypePorts(self, element: ET.Element, sw_component: AtomicSwComponentType):
|
|
1210
|
-
for child_element in
|
|
1235
|
+
for child_element in self.findall(element, "PORTS/*"):
|
|
1211
1236
|
tag_name = self.getTagName(child_element)
|
|
1212
1237
|
if tag_name == "P-PORT-PROTOTYPE":
|
|
1213
1238
|
self.readPPortPrototype(child_element, sw_component)
|
|
@@ -1277,19 +1302,19 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1277
1302
|
self.logger.debug("readPPortPrototype %s" % short_name)
|
|
1278
1303
|
prototype = parent.createPPortPrototype(short_name)
|
|
1279
1304
|
self.readIdentifiable(element, prototype)
|
|
1280
|
-
prototype.
|
|
1305
|
+
prototype.setProvidedInterfaceTRef(self.getChildElementOptionalRefType(element, "PROVIDED-INTERFACE-TREF"))
|
|
1281
1306
|
|
|
1282
1307
|
self.readProvidedComSpec(element, prototype)
|
|
1283
1308
|
|
|
1284
1309
|
def readPortGroupInnerGroupIRefs(self, element: ET.Element, parent: PortGroup):
|
|
1285
|
-
for child_element in
|
|
1310
|
+
for child_element in self.findall(element, "INNER-GROUP-IREFS/INNER-GROUP-IREF"):
|
|
1286
1311
|
inner_group_iref = InnerPortGroupInCompositionInstanceRef()
|
|
1287
|
-
inner_group_iref.contextRef = self.getChildElementOptionalRefType(child_element, "CONTEXT-REF")
|
|
1288
|
-
inner_group_iref.
|
|
1312
|
+
#inner_group_iref.contextRef = self.getChildElementOptionalRefType(child_element, "CONTEXT-REF")
|
|
1313
|
+
inner_group_iref.setTargetRef(self.getChildElementOptionalRefType(child_element, "TARGET-REF"))
|
|
1289
1314
|
parent.addInnerGroupIRef(inner_group_iref)
|
|
1290
1315
|
|
|
1291
1316
|
def readPortGroupOuterPortRefs(self, element: ET.Element, parent: PortGroup):
|
|
1292
|
-
for child_element in
|
|
1317
|
+
for child_element in self.findall(element, "OUTER-PORTS/PORT-PROTOTYPE-REF-CONDITIONAL"):
|
|
1293
1318
|
parent.addOuterPortRef(self.getChildElementOptionalRefType(child_element, "PORT-PROTOTYPE-REF"))
|
|
1294
1319
|
|
|
1295
1320
|
def readPortGroup(self, element: ET.Element, parent: SwComponentType):
|
|
@@ -1346,40 +1371,40 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1346
1371
|
self.readAtomicSwComponentType(element, sw_component)
|
|
1347
1372
|
|
|
1348
1373
|
def readPPortInCompositionInstanceRef(self, element: ET.Element, p_port_in_composition_instance_ref: PPortInCompositionInstanceRef):
|
|
1349
|
-
p_port_in_composition_instance_ref.
|
|
1350
|
-
|
|
1374
|
+
p_port_in_composition_instance_ref.setContextComponentRef(self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")) \
|
|
1375
|
+
.setTargetPPortRef(self.getChildElementOptionalRefType(element, "TARGET-P-PORT-REF"))
|
|
1351
1376
|
|
|
1352
1377
|
self.logger.debug("PPortInCompositionInstanceRef")
|
|
1353
1378
|
self.logger.debug(" CONTEXT-COMPONENT-REF DEST: %s, %s"
|
|
1354
|
-
% (p_port_in_composition_instance_ref.
|
|
1379
|
+
% (p_port_in_composition_instance_ref.getContextComponentRef().getDest(), p_port_in_composition_instance_ref.getContextComponentRef().getValue()))
|
|
1355
1380
|
self.logger.debug(" TARGET-P-PORT-REF DEST: %s, %s"
|
|
1356
|
-
% (p_port_in_composition_instance_ref.
|
|
1381
|
+
% (p_port_in_composition_instance_ref.getTargetPPortRef().getDest(), p_port_in_composition_instance_ref.getTargetPPortRef().getValue()))
|
|
1357
1382
|
|
|
1358
1383
|
def readRPortInCompositionInstanceRef(self, element, r_port_in_composition_instance_ref: RPortInCompositionInstanceRef):
|
|
1359
|
-
r_port_in_composition_instance_ref.
|
|
1360
|
-
|
|
1384
|
+
r_port_in_composition_instance_ref.setContextComponentRef(self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")) \
|
|
1385
|
+
.setTargetRPortRef(self.getChildElementOptionalRefType(element, "TARGET-R-PORT-REF"))
|
|
1361
1386
|
|
|
1362
1387
|
self.logger.debug("RPortInCompositionInstanceRef")
|
|
1363
1388
|
self.logger.debug(" CONTEXT-COMPONENT-REF DEST: %s, %s"
|
|
1364
|
-
% (r_port_in_composition_instance_ref.
|
|
1389
|
+
% (r_port_in_composition_instance_ref.getContextComponentRef().getDest(), r_port_in_composition_instance_ref.getContextComponentRef().getValue()))
|
|
1365
1390
|
self.logger.debug(" TARGET-P-PORT-REF DEST: %s, %s"
|
|
1366
|
-
% (r_port_in_composition_instance_ref.
|
|
1391
|
+
% (r_port_in_composition_instance_ref.getTargetRPortRef().getDest(), r_port_in_composition_instance_ref.getTargetRPortRef().getValue()))
|
|
1367
1392
|
|
|
1368
1393
|
def readAssemblySwConnectorProviderIRef(self, element: ET.Element, parent: AssemblySwConnector):
|
|
1369
|
-
child_element =
|
|
1394
|
+
child_element = self.find(element, "PROVIDER-IREF")
|
|
1370
1395
|
if (child_element is not None):
|
|
1371
1396
|
provide_iref = PPortInCompositionInstanceRef()
|
|
1372
1397
|
self.readElementAttributes(child_element, provide_iref)
|
|
1373
1398
|
self.readPPortInCompositionInstanceRef(child_element, provide_iref)
|
|
1374
|
-
parent.
|
|
1399
|
+
parent.setProviderIRef(provide_iref)
|
|
1375
1400
|
|
|
1376
1401
|
def readAssemblySwConnectorRequesterIRef(self, element: ET.Element, parent: AssemblySwConnector):
|
|
1377
|
-
child_element =
|
|
1402
|
+
child_element = self.find(element, "REQUESTER-IREF")
|
|
1378
1403
|
if (child_element is not None):
|
|
1379
1404
|
requester_iref = RPortInCompositionInstanceRef()
|
|
1380
1405
|
self.readElementAttributes(child_element, requester_iref)
|
|
1381
1406
|
self.readRPortInCompositionInstanceRef(child_element, requester_iref)
|
|
1382
|
-
parent.requester_iref
|
|
1407
|
+
parent.setRequesterIRef(requester_iref)
|
|
1383
1408
|
|
|
1384
1409
|
def readAssemblySwConnectors(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1385
1410
|
for child_element in element.findall("./xmlns:CONNECTORS/xmlns:ASSEMBLY-SW-CONNECTOR", self.nsmap):
|
|
@@ -1392,26 +1417,26 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1392
1417
|
self.readAssemblySwConnectorRequesterIRef(child_element, connector)
|
|
1393
1418
|
|
|
1394
1419
|
def readDelegationSwConnectorInnerPortIRef(self, element, parent: DelegationSwConnector):
|
|
1395
|
-
inner_port_iref_element =
|
|
1420
|
+
inner_port_iref_element = self.find(element, "INNER-PORT-IREF")
|
|
1396
1421
|
if (inner_port_iref_element is not None):
|
|
1397
|
-
child_element =
|
|
1422
|
+
child_element = self.find(inner_port_iref_element, "R-PORT-IN-COMPOSITION-INSTANCE-REF")
|
|
1398
1423
|
if (child_element is not None):
|
|
1399
1424
|
r_port_in_composition_instance_ref = RPortInCompositionInstanceRef()
|
|
1400
1425
|
self.readRPortInCompositionInstanceRef(child_element, r_port_in_composition_instance_ref)
|
|
1401
|
-
parent.
|
|
1426
|
+
parent.setInnerPortIRref(r_port_in_composition_instance_ref)
|
|
1402
1427
|
return
|
|
1403
1428
|
|
|
1404
|
-
child_element =
|
|
1429
|
+
child_element = self.find(inner_port_iref_element, "P-PORT-IN-COMPOSITION-INSTANCE-REF")
|
|
1405
1430
|
if (child_element is not None):
|
|
1406
1431
|
p_port_in_composition_instance_ref = PPortInCompositionInstanceRef()
|
|
1407
1432
|
self.readPPortInCompositionInstanceRef(child_element, p_port_in_composition_instance_ref)
|
|
1408
|
-
parent.
|
|
1433
|
+
parent.setInnerPortIRref(p_port_in_composition_instance_ref)
|
|
1409
1434
|
return
|
|
1410
1435
|
|
|
1411
1436
|
self._raiseError("Unsupported child element of INNER-PORT-IREF")
|
|
1412
1437
|
|
|
1413
1438
|
def readDelegationSwConnectors(self, element, parent: CompositionSwComponentType):
|
|
1414
|
-
for child_element in
|
|
1439
|
+
for child_element in self.findall(element, "CONNECTORS/DELEGATION-SW-CONNECTOR"):
|
|
1415
1440
|
short_name = self.getShortName(child_element)
|
|
1416
1441
|
self.logger.debug("readDelegationSwConnectors %s" % short_name)
|
|
1417
1442
|
|
|
@@ -1419,12 +1444,12 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1419
1444
|
self.readIdentifiable(child_element, connector)
|
|
1420
1445
|
self.readDelegationSwConnectorInnerPortIRef(child_element, connector)
|
|
1421
1446
|
|
|
1422
|
-
if connector.
|
|
1447
|
+
if connector.getInnerPortIRref() == None and connector.getOuterPortRef() == None:
|
|
1423
1448
|
self._raiseError("Invalid PortPrototype of DELEGATION-SW-CONNECTOR")
|
|
1424
1449
|
|
|
1425
|
-
connector.
|
|
1450
|
+
connector.setOuterPortRef(self.getChildElementOptionalRefType(child_element, "OUTER-PORT-REF"))
|
|
1426
1451
|
self.logger.debug("OUTER-PORT-REF DEST: %s, %s"
|
|
1427
|
-
% (connector.
|
|
1452
|
+
% (connector.getOuterPortRef().getDest(), connector.getOuterPortRef().getValue()))
|
|
1428
1453
|
|
|
1429
1454
|
def readSwComponentPrototypes(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1430
1455
|
for child_element in element.findall("./xmlns:COMPONENTS/xmlns:SW-COMPONENT-PROTOTYPE", self.nsmap):
|
|
@@ -1432,7 +1457,7 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1432
1457
|
self.logger.debug("readSwComponentPrototypes %s" % short_name)
|
|
1433
1458
|
prototype = parent.createSwComponentPrototype(short_name)
|
|
1434
1459
|
self.readIdentifiable(child_element, prototype)
|
|
1435
|
-
prototype.
|
|
1460
|
+
prototype.typeTRef = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
1436
1461
|
|
|
1437
1462
|
def readCompositionSwComponentTypeDataTypeMappingSet(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1438
1463
|
child_element = element.find("./xmlns:DATA-TYPE-MAPPING-REFS", self.nsmap)
|
|
@@ -1496,6 +1521,14 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1496
1521
|
.setHandleInvalid(self.getChildElementOptionalLiteral(child_element, "HANDLE-INVALID"))
|
|
1497
1522
|
sr_interface.addInvalidationPolicy(policy)
|
|
1498
1523
|
|
|
1524
|
+
def readInvalidationPolicys(self, element: ET.Element, parent: SenderReceiverInterface):
|
|
1525
|
+
for child_element in element.findall("./xmlns:INVALIDATION-POLICYS/xmlns:INVALIDATION-POLICY", self.nsmap):
|
|
1526
|
+
# short_name = self.getShortName(child_element)
|
|
1527
|
+
policy = parent.createInvalidationPolicy()
|
|
1528
|
+
self.readIdentifiable(child_element, policy)
|
|
1529
|
+
policy.data_element_ref = self.getChildElementOptionalRefType(child_element, "DATA-ELEMENT-REF")
|
|
1530
|
+
policy.handle_invalid = self.getChildElementOptionalLiteral(child_element, "HANDLE-INVALID")
|
|
1531
|
+
|
|
1499
1532
|
def readSenderReceiverInterfaces(self, element, parent: ARPackage):
|
|
1500
1533
|
short_name = self.getShortName(element)
|
|
1501
1534
|
sr_interface = parent.createSenderReceiverInterface(short_name)
|
|
@@ -1512,6 +1545,7 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1512
1545
|
prototype.swDataDefProps = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
1513
1546
|
prototype.typeTRef = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
1514
1547
|
prototype.direction = self.getChildElementOptionalLiteral(child_element, "DIRECTION")
|
|
1548
|
+
prototype.server_argument_impl_policy = self.getChildElementOptionalLiteral(child_element, "SERVER-ARGUMENT-IMPL-POLICY")
|
|
1515
1549
|
parent.addArgumentDataPrototype(prototype)
|
|
1516
1550
|
|
|
1517
1551
|
def readPossibleErrorRefs(self, element: ET.Element, parent: ClientServerOperation):
|
|
@@ -1532,6 +1566,7 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1532
1566
|
for child_element in element.findall("./xmlns:POSSIBLE-ERRORS/xmlns:APPLICATION-ERROR", self.nsmap):
|
|
1533
1567
|
short_name = self.getShortName(child_element)
|
|
1534
1568
|
error = parent.createApplicationError(short_name)
|
|
1569
|
+
self.readIdentifiable(child_element, error) # some errors has its uuid
|
|
1535
1570
|
error.error_code = self.getChildElementOptionalNumericalValue(child_element, "ERROR-CODE")
|
|
1536
1571
|
|
|
1537
1572
|
def readPortInterface(self, element: ET.Element, port_interface: PortInterface):
|
|
@@ -1582,6 +1617,7 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1582
1617
|
for child_element in element.findall('./xmlns:COMPU-SCALES/xmlns:COMPU-SCALE', self.nsmap):
|
|
1583
1618
|
compu_scale = CompuScale()
|
|
1584
1619
|
self.readElementAttributes(child_element, compu_scale)
|
|
1620
|
+
compu_scale.short_label = self.getChildElementOptionalLiteral(child_element, "SHORT-LABEL")
|
|
1585
1621
|
compu_scale.symbol = self.getChildElementOptionalLiteral(child_element, "SYMBOL")
|
|
1586
1622
|
compu_scale.lowerLimit = self.getChildLimitElement(child_element, "LOWER-LIMIT")
|
|
1587
1623
|
compu_scale.upperLimit = self.getChildLimitElement(child_element, "UPPER-LIMIT")
|
|
@@ -1768,10 +1804,10 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1768
1804
|
iref = None
|
|
1769
1805
|
if element is not None:
|
|
1770
1806
|
iref = VariableDataPrototypeInSystemInstanceRef()
|
|
1771
|
-
iref.
|
|
1772
|
-
iref.
|
|
1773
|
-
|
|
1774
|
-
|
|
1807
|
+
#iref.addContextComponentRef() = self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")
|
|
1808
|
+
iref.setContextCompositionRef(self.getChildElementOptionalRefType(element, "CONTEXT-COMPOSITION-REF")) \
|
|
1809
|
+
.setContextPortRef(self.getChildElementOptionalRefType(element, "CONTEXT-PORT-REF")) \
|
|
1810
|
+
.setTargetDataPrototypeRef(self.getChildElementOptionalRefType(element, "TARGET-DATA-PROTOTYPE-REF"))
|
|
1775
1811
|
return iref
|
|
1776
1812
|
|
|
1777
1813
|
def getEndToEndProtectionVariablePrototype(self, element: ET.Element) -> EndToEndProtectionVariablePrototype:
|
|
@@ -1815,6 +1851,20 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
1815
1851
|
self.readIdentifiable(element, data_type)
|
|
1816
1852
|
data_type.swDataDefProps = self.getSwDataDefProps(element, "SW-DATA-DEF-PROPS")
|
|
1817
1853
|
|
|
1854
|
+
def readImplementationProps(self, element: ET.Element, props: ImplementationProps):
|
|
1855
|
+
props.setSymbol(self.getChildElementOptionalLiteral(element, "SYMBOL"))
|
|
1856
|
+
|
|
1857
|
+
def readSymbolProps(self, element: ET.Element, props: SymbolProps):
|
|
1858
|
+
self.readImplementationProps(element, props)
|
|
1859
|
+
|
|
1860
|
+
def readImplementationDataTypeSymbolProps(self, element: ET.Element, data_type: ImplementationDataType):
|
|
1861
|
+
child_element = element.find("./xmlns:SYMBOL-PROPS", self.nsmap)
|
|
1862
|
+
if child_element is not None:
|
|
1863
|
+
short_name = self.getShortName(child_element)
|
|
1864
|
+
self.logger.debug("readSymbolProps %s" % short_name)
|
|
1865
|
+
props = data_type.createSymbolProps(short_name)
|
|
1866
|
+
self.readSymbolProps(child_element, props)
|
|
1867
|
+
|
|
1818
1868
|
def readApplicationDataType(self, element: ET.Element, data_type: ApplicationDataType):
|
|
1819
1869
|
self.readAutosarDataType(element, data_type)
|
|
1820
1870
|
|
|
@@ -2363,8 +2413,8 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
2363
2413
|
if child_element is not None:
|
|
2364
2414
|
instance_ref = AnyInstanceRef()
|
|
2365
2415
|
instance_ref.setBaseRef(self.getChildElementOptionalRefType(child_element, "BASE-REF")) \
|
|
2366
|
-
|
|
2367
|
-
|
|
2416
|
+
.setContextElementRef(self.getChildElementOptionalRefType(child_element, "CONTEXT-ELEMENT-REF")) \
|
|
2417
|
+
.setTargetRef(self.getChildElementOptionalRefType(child_element, "TARGET-REF"))
|
|
2368
2418
|
return instance_ref
|
|
2369
2419
|
|
|
2370
2420
|
def getEcucInstanceReferenceValue(self, element: ET.Element) -> EcucInstanceReferenceValue:
|
|
@@ -2556,9 +2606,22 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
2556
2606
|
system.setEcuExtractVersion(self.getChildElementOptionalLiteral(element, "ECU-EXTRACT-VERSION"))
|
|
2557
2607
|
for child_element in self.findall(element, "FIBEX-ELEMENTS/FIBEX-ELEMENT-REF-CONDITIONAL"):
|
|
2558
2608
|
system.addFibexElementRef(self.getChildElementOptionalRefType(child_element, "FIBEX-ELEMENT-REF"))
|
|
2559
|
-
|
|
2560
2609
|
self.readSystemMappings(element, system)
|
|
2561
2610
|
|
|
2611
|
+
def readParameterInterfaceParameters(self, element: ET.Element, parent: ParameterInterface):
|
|
2612
|
+
for child_element in element.findall("./xmlns:PARAMETERS/xmlns:PARAMETER-DATA-PROTOTYPE", self.nsmap):
|
|
2613
|
+
short_name = self.getShortName(child_element)
|
|
2614
|
+
prototype = parent.createParameter(short_name)
|
|
2615
|
+
self.readParameterDataPrototype(child_element, prototype)
|
|
2616
|
+
|
|
2617
|
+
def readParameterInterface(self, element: ET.Element, parent: ARPackage):
|
|
2618
|
+
short_name = self.getShortName(element)
|
|
2619
|
+
self.logger.debug("ParameterInterface %s" % short_name)
|
|
2620
|
+
pi_interface = parent.createParameterInterface(short_name)
|
|
2621
|
+
self.readIdentifiable(element, pi_interface)
|
|
2622
|
+
self.readParameterInterfaceParameters(element, pi_interface)
|
|
2623
|
+
|
|
2624
|
+
|
|
2562
2625
|
def readARPackageElements(self, element: ET.Element, parent: ARPackage):
|
|
2563
2626
|
for child_element in self.findall(element, "./ELEMENTS/*"):
|
|
2564
2627
|
tag_name = self.getTagName(child_element.tag)
|
|
@@ -2668,9 +2731,10 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
2668
2731
|
self.readEcucModuleConfigurationValues(child_element, parent)
|
|
2669
2732
|
elif tag_name == "PHYSICAL-DIMENSION":
|
|
2670
2733
|
self.readPhysicalDimensions(child_element, parent)
|
|
2734
|
+
elif tag_name == "PARAMETER-INTERFACE":
|
|
2735
|
+
self.readParameterInterface(child_element, parent)
|
|
2671
2736
|
else:
|
|
2672
2737
|
self._raiseError("Unsupported element type of ARPackage <%s>" % tag_name)
|
|
2673
|
-
#pass
|
|
2674
2738
|
|
|
2675
2739
|
def readARPackages(self, element: ET.Element, parent: ARPackage):
|
|
2676
2740
|
for child_element in element.findall("./xmlns:AR-PACKAGES/xmlns:AR-PACKAGE", self.nsmap):
|
|
@@ -2694,3 +2758,5 @@ class ARXMLParser(AbstractARXMLParser):
|
|
|
2694
2758
|
|
|
2695
2759
|
self.getAUTOSARInfo(root, document)
|
|
2696
2760
|
self.readARPackages(root, document)
|
|
2761
|
+
|
|
2762
|
+
document.reload()
|
|
@@ -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
10
|
from ....models.m2.autosar_templates.sw_component_template.port_interface import ClientServerInterface, DataInterface, PortInterface, SenderReceiverInterface
|
|
9
|
-
from ....models.sw_component import ApplicationSwComponentType, AtomicSwComponentType,
|
|
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
|
|
|
@@ -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)
|
|
@@ -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
5
|
from ....models.m2.autosar_templates.common_structure import ConstantReference, ConstantSpecification, ValueSpecification
|
|
5
|
-
from ....models.common_structure import
|
|
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
|
|
|
@@ -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)
|
|
@@ -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:
|