armodel 1.6.1__py3-none-any.whl → 1.6.2__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 +25 -22
- armodel/cli/arxml_format_cli.py +1 -4
- armodel/cli/connector_update_cli.py +1 -1
- armodel/cli/swc_list_cli.py +1 -1
- armodel/lib/sw_component.py +3 -1
- armodel/lib/system_signal.py +3 -1
- armodel/models/__init__.py +1 -1
- armodel/models/datatype.py +2 -3
- armodel/models/m2/autosar_templates/autosar_top_level_structure.py +120 -0
- armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +11 -5
- armodel/models/m2/autosar_templates/generic_structure/ar_package.py +528 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface/__init__.py +2 -2
- armodel/parser/abstract_arxml_parser.py +1 -1
- armodel/parser/arxml_parser.py +40 -29
- armodel/parser/connector_xlsx_parser.py +3 -1
- armodel/report/connector_xls_report.py +2 -1
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_datatype.py +1 -1
- armodel/tests/test_armodel/models/test_general_structure.py +1 -1
- armodel/tests/test_armodel/models/test_implementation.py +1 -1
- armodel/tests/test_armodel/models/test_port_interface.py +1 -1
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -1
- armodel/tests/test_armodel/parser/test_sw_components.py +1 -1
- armodel/writer/arxml_writer.py +2 -2
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/METADATA +1 -1
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/RECORD +30 -28
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/LICENSE +0 -0
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/WHEEL +0 -0
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/entry_points.txt +0 -0
- {armodel-1.6.1.dist-info → armodel-1.6.2.dist-info}/top_level.txt +0 -0
armodel/cli/arxml_dump_cli.py
CHANGED
|
@@ -2,7 +2,10 @@ import getopt
|
|
|
2
2
|
import sys
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
from ..models import
|
|
5
|
+
from ..models.m2.autosar_templates.sw_component_template.swc_internal_behavior.data_elements import VariableAccess
|
|
6
|
+
from ..models.m2.autosar_templates.generic_structure.ar_package import ARPackage
|
|
7
|
+
|
|
8
|
+
from ..models import AUTOSAR, SwComponentType, DataTypeMappingSet
|
|
6
9
|
from ..models import SwcInternalBehavior, ImplementationDataType
|
|
7
10
|
from ..models import BswModuleDescription, BswInternalBehavior, BswModuleEntity, BswModuleEntry
|
|
8
11
|
from ..models import PortPrototype, RPortPrototype, PPortPrototype
|
|
@@ -10,38 +13,38 @@ from ..models import SenderReceiverInterface, ClientServerInterface
|
|
|
10
13
|
from ..parser import ARXMLParser
|
|
11
14
|
|
|
12
15
|
def show_variable_access(indent:int, variable_access: VariableAccess):
|
|
13
|
-
if (variable_access.
|
|
14
|
-
accessed_variable_ref = variable_access.
|
|
15
|
-
if (accessed_variable_ref.
|
|
16
|
-
autosar_variable_in_impl_datatype = accessed_variable_ref.
|
|
17
|
-
print("%s: %s" % (" " * indent, autosar_variable_in_impl_datatype.
|
|
18
|
-
print("%s: %s" % (" " * indent, autosar_variable_in_impl_datatype.
|
|
16
|
+
if (variable_access.getAccessedVariableRef() != None):
|
|
17
|
+
accessed_variable_ref = variable_access.getAccessedVariableRef()
|
|
18
|
+
if (accessed_variable_ref.getAutosarVariableInImplDatatype() != None):
|
|
19
|
+
autosar_variable_in_impl_datatype = accessed_variable_ref.getAutosarVariableInImplDatatype()
|
|
20
|
+
print("%s: %s" % (" " * indent, autosar_variable_in_impl_datatype.getPortPrototypeRef().getValue()))
|
|
21
|
+
print("%s: %s" % (" " * indent, autosar_variable_in_impl_datatype.getTargetDataPrototypeRef().getValue()))
|
|
19
22
|
|
|
20
23
|
def show_port(indent:int, port_prototype: PortPrototype):
|
|
21
24
|
if (isinstance(port_prototype, RPortPrototype)):
|
|
22
|
-
print("%s-RPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.
|
|
25
|
+
print("%s-RPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.getRequiredInterfaceTRef().getValue()))
|
|
23
26
|
for client_com_spec in port_prototype.getClientComSpecs():
|
|
24
|
-
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.
|
|
27
|
+
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.getOperationRef().getValue()))
|
|
25
28
|
for com_spec in port_prototype.getNonqueuedReceiverComSpecs():
|
|
26
|
-
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.
|
|
29
|
+
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.getDataElementRef().getValue()))
|
|
27
30
|
elif (isinstance(port_prototype, PPortPrototype)):
|
|
28
|
-
print("%s-PPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.
|
|
31
|
+
print("%s-PPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.getProvidedInterfaceTRef().getValue()))
|
|
29
32
|
for com_spec in port_prototype.getNonqueuedSenderComSpecs():
|
|
30
|
-
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.
|
|
33
|
+
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.getDataElementRef().getValue()))
|
|
31
34
|
else:
|
|
32
35
|
raise ValueError("Unsupported Port prototype")
|
|
33
36
|
|
|
34
37
|
def show_type(indent: int, data_type: ImplementationDataType):
|
|
35
38
|
print("%s-Implementation Type: %s (%s)" % (" " * indent, data_type.short_name, data_type._parent.full_name))
|
|
36
|
-
print("%s : %s" % (" " * indent, data_type.
|
|
37
|
-
if (data_type.
|
|
38
|
-
if (data_type.
|
|
39
|
-
base_type_ref = data_type.
|
|
40
|
-
print("%s : %s (%s)" % (" " * indent, base_type_ref.
|
|
39
|
+
print("%s : %s" % (" " * indent, data_type.getCategory()))
|
|
40
|
+
if (data_type.getSwDataDefProps() != None):
|
|
41
|
+
if (data_type.getSwDataDefProps().getBaseTypeRef() != None):
|
|
42
|
+
base_type_ref = data_type.getSwDataDefProps().getBaseTypeRef()
|
|
43
|
+
print("%s : %s (%s)" % (" " * indent, base_type_ref.getValue(), base_type_ref.getDest()))
|
|
41
44
|
|
|
42
|
-
if (data_type.
|
|
43
|
-
implementation_data_type_ref = data_type.
|
|
44
|
-
print("%s : %s (%s)" % (" " * indent, implementation_data_type_ref.
|
|
45
|
+
if (data_type.getSwDataDefProps().getImplementationDataTypeRef() != None):
|
|
46
|
+
implementation_data_type_ref = data_type.getSwDataDefProps().getImplementationDataTypeRef()
|
|
47
|
+
print("%s : %s (%s)" % (" " * indent, implementation_data_type_ref.getValue(), implementation_data_type_ref.getDest()))
|
|
45
48
|
|
|
46
49
|
def show_data_type_mapping(indent: int, mapping_set: DataTypeMappingSet):
|
|
47
50
|
print("%s- Data Mapping Set <%s>:" % (" " * indent, mapping_set.short_name))
|
|
@@ -63,8 +66,8 @@ def show_behavior(indent:int, behavior: SwcInternalBehavior):
|
|
|
63
66
|
for server_call_point in runnable.getServerCallPoints():
|
|
64
67
|
print("%s-scp : %s" % (" " * (indent + 4), variable_access.short_name))
|
|
65
68
|
if (server_call_point.operation_iref != None):
|
|
66
|
-
print("%s: %s" % (" " * (indent + 9), server_call_point.
|
|
67
|
-
print("%s: %s" % (" " * (indent + 9), server_call_point.
|
|
69
|
+
print("%s: %s" % (" " * (indent + 9), server_call_point.getOperationIRef().getContextRPortRef().getValue()))
|
|
70
|
+
print("%s: %s" % (" " * (indent + 9), server_call_point.getOperationIRef().getTargetRequiredOperationRef().getValue()))
|
|
68
71
|
for event in behavior.getOperationInvokedEvents():
|
|
69
72
|
print(" - OperationInvokedEvent : %s" % event.short_name)
|
|
70
73
|
print(" : %s" % (event.start_on_event_ref.value))
|
armodel/cli/arxml_format_cli.py
CHANGED
|
@@ -5,11 +5,8 @@ import sys
|
|
|
5
5
|
import os.path
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
from ..models.
|
|
8
|
+
from ..models.m2.autosar_templates.autosar_top_level_structure import AUTOSAR
|
|
9
9
|
from ..parser.arxml_parser import ARXMLParser
|
|
10
|
-
from ..parser.connector_xlsx_parser import ConnectorXlsReader
|
|
11
|
-
|
|
12
|
-
from ..lib import InputFileParser
|
|
13
10
|
from ..writer import ARXMLWriter
|
|
14
11
|
|
|
15
12
|
def main():
|
|
@@ -5,7 +5,7 @@ import sys
|
|
|
5
5
|
import os.path
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
from ..models.
|
|
8
|
+
from ..models.m2.autosar_templates.autosar_top_level_structure import AUTOSAR
|
|
9
9
|
from ..parser.arxml_parser import ARXMLParser
|
|
10
10
|
from ..parser.connector_xlsx_parser import ConnectorXlsReader
|
|
11
11
|
|
armodel/cli/swc_list_cli.py
CHANGED
armodel/lib/sw_component.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
3
|
from typing import List
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
from ..models.m2.autosar_templates.generic_structure.ar_package import ARPackage
|
|
6
|
+
from ..models import AUTOSAR, AtomicSwComponentType, CompositionSwComponentType
|
|
5
7
|
|
|
6
8
|
class SwComponentAnalyzer:
|
|
7
9
|
def __init__(self) -> None:
|
armodel/lib/system_signal.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
-
from ..models.ar_package import
|
|
4
|
+
from ..models.m2.autosar_templates.generic_structure.ar_package import ARPackage
|
|
5
|
+
|
|
6
|
+
from ..models.m2.autosar_templates.autosar_top_level_structure import AUTOSAR
|
|
5
7
|
from ..models.fibex.fibex_core.core_communication import SystemSignal
|
|
6
8
|
|
|
7
9
|
class SystemSignalAnalyzer:
|
armodel/models/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@ from .ar_object import *
|
|
|
3
3
|
from .general_structure import *
|
|
4
4
|
from .common_structure import *
|
|
5
5
|
from .sw_component import *
|
|
6
|
-
from .
|
|
6
|
+
from .m2.autosar_templates.autosar_top_level_structure import *
|
|
7
7
|
from .ar_ref import *
|
|
8
8
|
from .datatype import *
|
|
9
9
|
from .port_prototype import *
|
armodel/models/datatype.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from .m2.msr.data_dictionary.data_def_properties import SwDataDefProps
|
|
4
5
|
from .ar_object import ARLiteral, ARNumerical
|
|
5
6
|
from .ar_ref import RefType
|
|
6
7
|
from .general_structure import ARElement, ARObject
|
|
@@ -133,11 +134,9 @@ class ApplicationRecordDataType(ApplicationCompositeDataType):
|
|
|
133
134
|
def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
|
|
134
135
|
return self.record_elements
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
137
|
class DataTypeMap(ARObject):
|
|
140
138
|
def __init__(self):
|
|
139
|
+
|
|
141
140
|
self.application_data_type_ref = None # type: RefType
|
|
142
141
|
self.implementation_data_type_ref = None # type: RefType
|
|
143
142
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
from .generic_structure.ar_package import ARPackage
|
|
4
|
+
from .common_structure.implementation_data_types import ImplementationDataType
|
|
5
|
+
|
|
6
|
+
from ...general_structure import Referrable, CollectableElement
|
|
7
|
+
|
|
8
|
+
from ...datatype import ApplicationDataType, DataTypeMap, SwBaseType
|
|
9
|
+
|
|
10
|
+
class AbstractAUTOSAR(CollectableElement):
|
|
11
|
+
def __init__(self):
|
|
12
|
+
super().__init__()
|
|
13
|
+
|
|
14
|
+
CollectableElement.__init__(self)
|
|
15
|
+
|
|
16
|
+
self.schema_location = ""
|
|
17
|
+
self._appl_impl_type_maps = {}
|
|
18
|
+
self._impl_appl_type_maps = {}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
self._ar_packages = {} # type: Dict[str, ARPackage]
|
|
22
|
+
self.short_name_mappings = {} # type: Dict[str, str]
|
|
23
|
+
|
|
24
|
+
def reload(self):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def full_name(self):
|
|
29
|
+
return ""
|
|
30
|
+
|
|
31
|
+
def clear(self):
|
|
32
|
+
self._ar_packages = {}
|
|
33
|
+
self.elements = {}
|
|
34
|
+
|
|
35
|
+
def getElement(self, short_name: str) -> Referrable:
|
|
36
|
+
if (short_name in self._ar_packages):
|
|
37
|
+
return self._ar_packages[short_name]
|
|
38
|
+
return CollectableElement.getElement(self, short_name)
|
|
39
|
+
|
|
40
|
+
def getARPackages(self) -> List[ARPackage]:
|
|
41
|
+
#return list(filter(lambda e: isinstance(e, ARPackage), self.elements.values()))
|
|
42
|
+
return list(sorted(self._ar_packages.values(), key= lambda a: a.short_name))
|
|
43
|
+
|
|
44
|
+
def createARPackage(self, short_name: str) -> ARPackage:
|
|
45
|
+
if (short_name not in self._ar_packages):
|
|
46
|
+
ar_package = ARPackage(self, short_name)
|
|
47
|
+
self._ar_packages[short_name] = ar_package
|
|
48
|
+
return self._ar_packages[short_name]
|
|
49
|
+
|
|
50
|
+
def find(self, referred_name: str) -> Referrable:
|
|
51
|
+
short_name_list = referred_name.split("/")
|
|
52
|
+
element = AUTOSAR.getInstance()
|
|
53
|
+
for short_name in short_name_list:
|
|
54
|
+
if (short_name == ""):
|
|
55
|
+
continue
|
|
56
|
+
element = element.getElement(short_name)
|
|
57
|
+
if (element == None):
|
|
58
|
+
return element
|
|
59
|
+
# raise ValueError("The %s of reference <%s> does not exist." % (short_name, referred_name))
|
|
60
|
+
return element
|
|
61
|
+
|
|
62
|
+
def findByShortName(self, short_name: str) -> Referrable:
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
def getDataType(self, data_type: ImplementationDataType) -> ImplementationDataType:
|
|
66
|
+
if (isinstance(data_type, ImplementationDataType) or isinstance(data_type, SwBaseType)):
|
|
67
|
+
if (data_type.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
68
|
+
referred_type = self.find(data_type.swDataDefProps.implementationDataTypeRef.value)
|
|
69
|
+
return self.getDataType(referred_type)
|
|
70
|
+
if (data_type.category == ImplementationDataType.CATEGORY_DATA_REFERENCE):
|
|
71
|
+
if (data_type.swDataDefProps.swPointerTargetProps.target_category == "VALUE"):
|
|
72
|
+
referred_type = self.find(data_type.swDataDefProps.swPointerTargetProps.sw_data_def_props.baseTypeRef.value)
|
|
73
|
+
return self.getDataType(referred_type)
|
|
74
|
+
return data_type
|
|
75
|
+
else:
|
|
76
|
+
raise ValueError("%s is not ImplementationDataType." % data_type)
|
|
77
|
+
|
|
78
|
+
def addDataTypeMap(self, data_type_map: DataTypeMap):
|
|
79
|
+
if (data_type_map.application_data_type_ref is None) or (data_type_map.implementation_data_type_ref is None):
|
|
80
|
+
return
|
|
81
|
+
self._appl_impl_type_maps[data_type_map.application_data_type_ref.value] = data_type_map.implementation_data_type_ref.value
|
|
82
|
+
self._impl_appl_type_maps[data_type_map.implementation_data_type_ref.value] = data_type_map.application_data_type_ref.value
|
|
83
|
+
|
|
84
|
+
def convertToImplementationDataType(self, appl_data_type: str) -> ImplementationDataType:
|
|
85
|
+
if (appl_data_type not in self._appl_impl_type_maps.keys()):
|
|
86
|
+
raise IndexError("Invalid application data type <%s>" % appl_data_type)
|
|
87
|
+
|
|
88
|
+
return self.find(self._appl_impl_type_maps[appl_data_type])
|
|
89
|
+
|
|
90
|
+
def convertToApplicationDataType(self, impl_data_type: str) -> ApplicationDataType:
|
|
91
|
+
if (impl_data_type not in self._impl_appl_type_maps.keys()):
|
|
92
|
+
raise IndexError("Invalid Implementation data type <%s>" % impl_data_type)
|
|
93
|
+
|
|
94
|
+
return self.find(self._impl_appl_type_maps[impl_data_type])
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class AUTOSAR (AbstractAUTOSAR):
|
|
98
|
+
__instance = None
|
|
99
|
+
|
|
100
|
+
@staticmethod
|
|
101
|
+
def getInstance():
|
|
102
|
+
if (AUTOSAR.__instance == None):
|
|
103
|
+
AUTOSAR()
|
|
104
|
+
return AUTOSAR.__instance
|
|
105
|
+
|
|
106
|
+
def new(self):
|
|
107
|
+
self.clear()
|
|
108
|
+
|
|
109
|
+
def __init__(self):
|
|
110
|
+
if (AUTOSAR.__instance != None):
|
|
111
|
+
raise Exception("The AUTOSAR is singleton!")
|
|
112
|
+
|
|
113
|
+
AUTOSAR.__instance = self
|
|
114
|
+
|
|
115
|
+
super().__init__()
|
|
116
|
+
|
|
117
|
+
class AUTOSARDoc(AbstractAUTOSAR):
|
|
118
|
+
def __init__(self):
|
|
119
|
+
super().__init__()
|
|
120
|
+
|
|
@@ -85,6 +85,7 @@ class AbstractImplementationDataType(AutosarDataType, metaclass = ABCMeta):
|
|
|
85
85
|
super().__init__(parent, short_name)
|
|
86
86
|
|
|
87
87
|
class ImplementationDataType(AbstractImplementationDataType):
|
|
88
|
+
|
|
88
89
|
CATEGORY_TYPE_REFERENCE = "TYPE_REFERENCE"
|
|
89
90
|
CATEGORY_TYPE_VALUE = "VALUE"
|
|
90
91
|
CATEGORY_TYPE_STRUCTURE = "STRUCTURE"
|
|
@@ -93,17 +94,22 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
93
94
|
|
|
94
95
|
def __init__(self, parent: ARObject, short_name: str):
|
|
95
96
|
super().__init__(parent, short_name)
|
|
97
|
+
|
|
98
|
+
self.arrayImplPolicy = None
|
|
99
|
+
self.arraySize = None
|
|
100
|
+
self.arraySizeHandling = None # type: ARLiteral
|
|
101
|
+
self.arraySizeSemantics = None # type: ARLiteral
|
|
96
102
|
|
|
97
|
-
self.
|
|
98
|
-
self.symbolProps = None
|
|
99
|
-
self._type_emitter = None
|
|
103
|
+
self.subElements = [] # type: List[str]
|
|
104
|
+
self.symbolProps = None # type: SymbolProps
|
|
105
|
+
self._type_emitter = None # type: ARLiteral
|
|
100
106
|
|
|
101
107
|
self._array_type = None # ImplementationDataType
|
|
102
108
|
self._struct_type = None # ImplementationDataType
|
|
103
109
|
|
|
104
110
|
|
|
105
111
|
def createImplementationDataTypeElement(self, short_name: str) -> ImplementationDataTypeElement:
|
|
106
|
-
self.
|
|
112
|
+
self.subElements.append(short_name)
|
|
107
113
|
if (short_name not in self.elements):
|
|
108
114
|
event = ImplementationDataTypeElement(self, short_name)
|
|
109
115
|
self.elements[short_name] = event
|
|
@@ -111,7 +117,7 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
111
117
|
|
|
112
118
|
def getImplementationDataTypeElements(self) -> List[ImplementationDataTypeElement]:
|
|
113
119
|
elements = []
|
|
114
|
-
for sub_element in self.
|
|
120
|
+
for sub_element in self.subElements:
|
|
115
121
|
elements.append(self.elements[sub_element])
|
|
116
122
|
return elements
|
|
117
123
|
# return filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values())
|