def parseParameterInterface(self, xmlRoot, rootProject=None, parent=None): assert (xmlRoot.tag == 'CALPRM-INTERFACE') xmlName = xmlRoot.find("./SHORT-NAME") if xmlName is not None: if self.version == 3: portInterface = autosar.portinterface.ParameterInterface( xmlName.text) if xmlRoot.find("./IS-SERVICE").text == 'true': portInterface.isService = True for xmlElem in xmlRoot.findall( './CALPRM-ELEMENTS/CALPRM-ELEMENT-PROTOTYPE'): xmlElemName = xmlElem.find("./SHORT-NAME") if xmlElemName is not None: typeRef = xmlElem.find("./TYPE-TREF").text dataElem = autosar.portinterface.DataElement( xmlElemName.text, typeRef, parent=portInterface) if hasAdminData(xmlElem): dataElem.adminData = parseAdminDataNode( xmlElem.find('ADMIN-DATA')) if xmlElem.find('SW-DATA-DEF-PROPS'): for xmlItem in xmlElem.findall( 'SW-DATA-DEF-PROPS/SW-ADDR-METHOD-REF'): dataElem.swAddrMethodRefList.append( xmlItem.text) portInterface.dataElements.append(dataElem) return portInterface
def parseClientServerInterface(self,xmlRoot,parent=None): assert(xmlRoot.tag=='CLIENT-SERVER-INTERFACE') name = self.parseTextNode(xmlRoot.find('SHORT-NAME')) if name is not None: portInterface = autosar.portinterface.ClientServerInterface(name) if hasAdminData(xmlRoot): portInterface.adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) for xmlElem in xmlRoot.findall('./*'): if (xmlElem.tag == 'SHORT-NAME') or (xmlElem.tag == 'ADMIN-DATA'): continue elif xmlElem.tag == 'IS-SERVICE': if self.parseTextNode(xmlElem) == 'true': portInterface.isService = True elif xmlElem.tag == 'OPERATIONS': for xmlChildItem in xmlElem.findall('./*'): if (self.version < 4.0 and xmlChildItem.tag == 'OPERATION-PROTOTYPE') or (self.version >= 4.0 and xmlChildItem.tag == 'CLIENT-SERVER-OPERATION'): operation = self._parseOperationPrototype(xmlChildItem, portInterface) portInterface.operations.append(operation) else: raise NotImplementedError(xmlChildItem.tag) elif xmlElem.tag == 'POSSIBLE-ERRORS': for xmlError in xmlElem.findall('APPLICATION-ERROR'): applicationError = self._parseApplicationError(xmlError, portInterface) portInterface.applicationErrors.append(applicationError) elif xmlElem.tag == 'SERVICE-KIND': portInterface.serviceKind = self.parseTextNode(xmlElem) else: raise NotImplementedError(xmlElem.tag) return portInterface
def parseSystem(self, xmlRoot, parent=None): """ parses <SYSTEM> """ assert (xmlRoot.tag == 'SYSTEM') xmlName = xmlRoot.find('SHORT-NAME') if xmlName is not None: system = System(parseTextNode(xmlName), parent) for xmlElem in xmlRoot.findall('./*'): if xmlElem.tag == 'SHORT-NAME': pass elif xmlElem.tag == 'ADMIN-DATA': system.adminData = parseAdminDataNode(xmlElem) elif xmlElem.tag == 'FIBEX-ELEMENT-REFS': self.parseFibexElementRefs(xmlElem, system) elif xmlElem.tag == 'MAPPING': self.parseSystemMapping(xmlElem, system) elif xmlElem.tag == 'SOFTWARE-COMPOSITION': self.parseSoftwareComposition(xmlElem, system) elif xmlElem.tag == 'TOPOLOGY': pass elif xmlElem.tag == 'COMMUNICATION': pass else: raise NotImplementedError(xmlElem.tag) return system else: raise KeyError('expected to find <SHORT-NAME> inside <SYSTEM> tag')
def parseImplementationDataType(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'IMPLEMENTATION-DATA-TYPE') name = parseTextNode(xmlRoot.find("./SHORT-NAME")) category = parseTextNode(xmlRoot.find( "./CATEGORY")) #category is a generic string identifier dataType = ImplementationDataType(name, category) self.parseDesc(xmlRoot, dataType) alreadyProcessed = ['SHORT-NAME', 'CATEGORY'] for xmlItem in xmlRoot.findall('./*'): if xmlItem.tag in alreadyProcessed: pass elif xmlItem.tag == 'SW-DATA-DEF-PROPS': dataType.variantProps = self.parseSwDataDefProps(xmlItem) elif xmlItem.tag == 'ADMIN-DATA': dataType.adminData = parseAdminDataNode(xmlItem) elif xmlItem.tag == 'DESC': self.parseDesc(xmlItem, dataType) elif xmlItem.tag == 'TYPE-EMITTER': dataType.typeEmitter = parseTextNode(xmlItem) elif xmlItem.tag == 'DYNAMIC-ARRAY-SIZE-PROFILE': dataType.dynamicArraySizeProfile = parseTextNode(xmlItem) elif xmlItem.tag == 'SUB-ELEMENTS': dataType.subElements = self.parseImplementationDataTypeSubElements( xmlItem, dataType) else: raise NotImplementedError(xmlItem.tag) return dataType
def parseDataTypeMappingSet(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'DATA-TYPE-MAPPING-SET') (name, dataTypeMaps, adminData) = (None, None, None) dataTypeMaps = [] for xmlElem in xmlRoot.findall('./*'): if xmlElem.tag == 'ADMIN-DATA': adminData = parseAdminDataNode(xmlItem) if xmlElem.tag == 'SHORT-NAME': name = self.parseTextNode(xmlElem) elif xmlElem.tag == 'DATA-TYPE-MAPS': for xmlChild in xmlElem.findall('./*'): if xmlChild.tag == 'DATA-TYPE-MAP': dataTypeMap = self.parseDataTypeMap(xmlChild) assert (dataTypeMap is not None) dataTypeMaps.append(dataTypeMap) else: raise NotImplementedError(xmlElem.tag) else: raise NotImplementedError(xmlElem.tag) if (name is None): raise RuntimeError('SHORT-NAME cannot be None') elem = DataTypeMappingSet(name, parent, adminData) for dataTypeMap in dataTypeMaps: elem.add(dataTypeMap) return elem
def parseDataTypeMappingSet(self, xmlRoot, parent = None): assert (xmlRoot.tag == 'DATA-TYPE-MAPPING-SET') (name, dataTypeMaps, adminData) = (None, None, None) dataTypeMaps = [] for xmlElem in xmlRoot.findall('./*'): if xmlElem.tag == 'ADMIN-DATA': adminData=parseAdminDataNode(xmlItem) if xmlElem.tag == 'SHORT-NAME': name = self.parseTextNode(xmlElem) elif xmlElem.tag == 'DATA-TYPE-MAPS': for xmlChild in xmlElem.findall('./*'): if xmlChild.tag == 'DATA-TYPE-MAP': dataTypeMap = self.parseDataTypeMap(xmlChild) assert(dataTypeMap is not None) dataTypeMaps.append(dataTypeMap) else: raise NotImplementedError(xmlElem.tag) else: raise NotImplementedError(xmlElem.tag) if (name is None): raise RuntimeError('SHORT-NAME cannot be None') elem = DataTypeMappingSet(name, parent, adminData) for dataTypeMap in dataTypeMaps: elem.add(dataTypeMap) return elem
def parseImplementationDataType(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'IMPLEMENTATION-DATA-TYPE') name = parseTextNode(xmlRoot.find("./SHORT-NAME")) category = parseTextNode(xmlRoot.find("./CATEGORY")) #category is a generic string identifier dataType = ImplementationDataType(name, category) self.parseDesc(xmlRoot,dataType) alreadyProcessed = ['SHORT-NAME','CATEGORY'] for xmlItem in xmlRoot.findall('./*'): if xmlItem.tag in alreadyProcessed: pass elif xmlItem.tag == 'SW-DATA-DEF-PROPS': dataType.variants = self.parseSwDataDefProps(xmlItem) elif xmlItem.tag == 'ADMIN-DATA': dataType.adminData=parseAdminDataNode(xmlItem) elif xmlItem.tag == 'DESC': self.parseDesc(xmlItem, dataType) elif xmlItem.tag == 'TYPE-EMITTER': dataType.typeEmitter = parseTextNode(xmlItem) elif xmlItem.tag == 'DYNAMIC-ARRAY-SIZE-PROFILE': dataType.dynamicArraySize = parseTextNode(xmlItem) elif xmlItem.tag == 'SUB-ELEMENTS': dataType.subElements = self.parseImplementationDataTypeSubElements(xmlItem, dataType) else: raise NotImplementedError(xmlItem.tag) return dataType
def parseDataConstraint(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'DATA-CONSTR') name = xmlRoot.find("./SHORT-NAME").text rules=[] for xmlItem in xmlRoot.findall('./DATA-CONSTR-RULES/DATA-CONSTR-RULE/*'): if xmlItem.tag == 'INTERNAL-CONSTRS': lowerLimitXML = xmlItem.find('./LOWER-LIMIT') upperLimitXML = xmlItem.find('./UPPER-LIMIT') lowerLimit = parseTextNode(lowerLimitXML) upperLimit = parseTextNode(upperLimitXML) lowerLimitType = 'CLOSED' upperLimitType = 'CLOSED' if lowerLimitXML.attrib['INTERVAL-TYPE']=='OPEN': lowerLimitType='OPEN' if upperLimitXML.attrib['INTERVAL-TYPE']=='OPEN': upperLimitType='OPEN' try: lowerLimit = int(lowerLimit) except ValueError: lowerLimit = str(lowerLimit) try: upperLimit = int(upperLimit) except ValueError: upperLimit = str(upperLimit) rules.append({'type': 'internalConstraint', 'lowerLimit':lowerLimit, 'upperLimit':upperLimit, 'lowerLimitType':lowerLimitType, 'upperLimitType':upperLimitType,}) else: raise NotImplementedError(xmlItem.tag) elem = DataConstraint(name, rules, parent) if hasAdminData(xmlRoot): elem.adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) return elem
def parseSenderReceiverInterface(self, xmlRoot, rootProject=None, parent=None): name = xmlRoot.find("./SHORT-NAME") if name is not None: if self.version == 3: portInterface = autosar.portinterface.SenderReceiverInterface( name.text) if hasAdminData(xmlRoot): portInterface.adminData = parseAdminDataNode( xmlRoot.find('ADMIN-DATA')) if xmlRoot.find("./IS-SERVICE").text == 'true': portInterface.isService = True for xmlItem in xmlRoot.findall( './DATA-ELEMENTS/DATA-ELEMENT-PROTOTYPE'): name = xmlItem.find("./SHORT-NAME") if name is not None: isQueued = True if xmlItem.find( "./IS-QUEUED").text == 'true' else False typeRef = xmlItem.find("./TYPE-TREF").text dataElem = autosar.portinterface.DataElement( name.text, typeRef, isQueued, parent=portInterface) portInterface.dataElements.append(dataElem) if xmlRoot.find('MODE-GROUPS') is not None: portInterface.modeGroups = [] for xmlItem in xmlRoot.findall( './MODE-GROUPS/MODE-DECLARATION-GROUP-PROTOTYPE'): modeGroup = autosar.portinterface.ModeGroup( xmlItem.find("./SHORT-NAME").text, xmlItem.find("./TYPE-TREF").text, portInterface) portInterface.modeGroups.append(modeGroup) return portInterface
def parseCalPrmInterface(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'CALPRM-INTERFACE') xmlName = xmlRoot.find("./SHORT-NAME") if xmlName is not None: portInterface = autosar.portinterface.ParameterInterface( xmlName.text) if xmlRoot.find("./IS-SERVICE").text == 'true': portInterface.isService = True for xmlElem in xmlRoot.findall( './CALPRM-ELEMENTS/CALPRM-ELEMENT-PROTOTYPE'): xmlElemName = xmlElem.find("./SHORT-NAME") if xmlElemName is not None: typeRef = xmlElem.find("./TYPE-TREF").text parameter = autosar.portinterface.Parameter( xmlElemName.text, typeRef, parent=portInterface) if hasAdminData(xmlElem): parameter.adminData = parseAdminDataNode( xmlElem.find('ADMIN-DATA')) if xmlElem.find('SW-DATA-DEF-PROPS'): for xmlItem in xmlElem.findall( 'SW-DATA-DEF-PROPS/SW-ADDR-METHOD-REF'): parameter.swAddressMethodRef = self.parseTextNode( xmlItem) portInterface.elements.append(parameter) return portInterface
def parseDataTypeMappingSet(self, xmlRoot, dummy, parent=None): assert (xmlRoot.tag == 'DATA-TYPE-MAPPING-SET') name = parseTextNode(xmlRoot.find('SHORT-NAME')) if hasAdminData(xmlRoot): adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) else: adminData = None return DataTypeMappingSet(name, parent, adminData)
def parseSwBaseType(self, xmlRoot, dummy, parent=None): assert (xmlRoot.tag == 'SW-BASE-TYPE') name = parseTextNode(xmlRoot.find('SHORT-NAME')) size = parseTextNode(xmlRoot.find('BASE-TYPE-SIZE')) typeEncoding = parseTextNode(xmlRoot.find('BASE-TYPE-ENCODING')) nativeDeclaration = parseTextNode(xmlRoot.find('NATIVE-DECLARATION')) category = parseTextNode(xmlRoot.find('CATEGORY')) if hasAdminData(xmlRoot): adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) else: adminData = None return SwBaseType(name, size, typeEncoding, nativeDeclaration, category, parent, adminData)
def parseModeDeclarationGroup(self,xmlRoot,rootProject=None,parent=None): assert(xmlRoot.tag == 'MODE-DECLARATION-GROUP') name = xmlRoot.find("./SHORT-NAME").text initialModeRef = None modeDeclarations = None if xmlRoot.find('./INITIAL-MODE-REF'): modeDeclarations = self.parseModeDeclarations(xmlRoot.find('./INITIAL-MODE-REF'),rootProject) if xmlRoot.find('./INITIAL-MODE-REF'): initialModeRef = xmlRoot.find('./INITIAL-MODE-REF').text modeDclrGroup = ModeDeclarationGroup(name,initialModeRef,modeDeclarations) if hasAdminData(xmlRoot): adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) modeDclrGroup.adminData = adminData return modeDclrGroup
def parseSwBaseType(self, xmlRoot, parent = None): assert (xmlRoot.tag == 'SW-BASE-TYPE') name = parseTextNode(xmlRoot.find('SHORT-NAME')) size = parseTextNode(xmlRoot.find('BASE-TYPE-SIZE')) typeEncoding = parseTextNode(xmlRoot.find('BASE-TYPE-ENCODING')) nativeDeclaration = parseTextNode(xmlRoot.find('NATIVE-DECLARATION')) category = parseTextNode(xmlRoot.find('CATEGORY')) if hasAdminData(xmlRoot): adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) else: adminData=None elem = SwBaseType(name, size, typeEncoding, nativeDeclaration, category, parent, adminData) self.parseDesc(xmlRoot,elem) return elem
def parseCalPrmElemPrototype(self, xmlRoot, parent): """ parses <CALPRM-ELEMENT-PROTOTYPE> """ name = parseTextNode(xmlRoot.find('SHORT-NAME')) adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) typeRef = parseTextNode(xmlRoot.find('TYPE-TREF')) calPrmElemPrototype = CalPrmElemPrototype(name, typeRef, parent, adminData) for xmlElem in xmlRoot.findall('./SW-DATA-DEF-PROPS/*'): if xmlElem.tag=='SW-ADDR-METHOD-REF': calPrmElemPrototype.swDataDefsProps.append(parseTextNode(xmlElem)) else: raise NotImplementedError(xmlElem.tag) return calPrmElemPrototype
def parseConstantSpecification(self,xmlRoot,rootProject=None,parent=None): assert(xmlRoot.tag == 'CONSTANT-SPECIFICATION') xmlName = xmlRoot.find('SHORT-NAME') if xmlName is not None: name = xmlName.text xmlValue = xmlRoot.find('./VALUE/*') if xmlValue is not None: constantValue = self.parseConstantValue(xmlValue) else: constantValue = None constant = Constant(name,constantValue) if hasAdminData(xmlRoot): constant.adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) return constant return None
def parseClientServerInterface(self, xmlRoot, rootProject=None, parent=None): assert (xmlRoot.tag == 'CLIENT-SERVER-INTERFACE') xmlName = xmlRoot.find("./SHORT-NAME") if xmlName is not None: if self.version == 3: portInterface = autosar.portinterface.ClientServerInterface( xmlName.text) if hasAdminData(xmlRoot): portInterface.adminData = parseAdminDataNode( xmlRoot.find('ADMIN-DATA')) if xmlRoot.find("./IS-SERVICE").text == 'true': portInterface.isService = True for xmlOperation in xmlRoot.findall( './OPERATIONS/OPERATION-PROTOTYPE'): xmlOperationName = xmlOperation.find("./SHORT-NAME") if xmlOperationName is not None: operation = autosar.portinterface.Operation( xmlOperationName.text, portInterface) self.parseDesc(xmlOperation, operation) if xmlOperation.find('./ARGUMENTS') is not None: for xmlArgument in xmlOperation.findall( './ARGUMENTS/ARGUMENT-PROTOTYPE'): name = xmlArgument.find("./SHORT-NAME").text typeRef = xmlArgument.find("./TYPE-TREF").text direction = xmlArgument.find( "./DIRECTION").text operation.arguments.append( autosar.portinterface.Argument( name, typeRef, direction)) if xmlOperation.find('./POSSIBLE-ERROR-REFS'): for xmlErrorRef in xmlOperation.findall( './POSSIBLE-ERROR-REFS/POSSIBLE-ERROR-REF' ): operation.errorRefs.append(xmlErrorRef.text) portInterface.operations.append(operation) if xmlRoot.find('./POSSIBLE-ERRORS'): for xmlError in xmlRoot.findall( './POSSIBLE-ERRORS/APPLICATION-ERROR'): name = xmlError.find("./SHORT-NAME").text errorCode = xmlError.find("./ERROR-CODE").text portInterface.applicationErrors.append( autosar.portinterface.ApplicationError( name, errorCode, portInterface)) return portInterface
def parseModeDeclarationGroup(self, xmlRoot, rootProject=None, parent=None): assert (xmlRoot.tag == 'MODE-DECLARATION-GROUP') name = parseTextNode(xmlRoot.find("./SHORT-NAME")) initialModeRef = parseTextNode(xmlRoot.find('./INITIAL-MODE-REF')) modeDclrGroup = autosar.portinterface.ModeDeclarationGroup( name, initialModeRef, None, parent) if xmlRoot.find('./MODE-DECLARATIONS') is not None: self.parseModeDeclarations(xmlRoot.find('./MODE-DECLARATIONS'), modeDclrGroup) if hasAdminData(xmlRoot): adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) modeDclrGroup.adminData = adminData return modeDclrGroup
def parseParameterInterface(self,xmlRoot,rootProject=None,parent=None): assert(xmlRoot.tag=='CALPRM-INTERFACE') xmlName = xmlRoot.find("./SHORT-NAME") if xmlName is not None: if self.version==3: portInterface = ParameterInterface(xmlName.text) if xmlRoot.find("./IS-SERVICE").text == 'true': portInterface.isService = True for xmlElem in xmlRoot.findall('./CALPRM-ELEMENTS/CALPRM-ELEMENT-PROTOTYPE'): xmlElemName = xmlElem.find("./SHORT-NAME") if xmlElemName is not None: typeRef=xmlElem.find("./TYPE-TREF").text dataElem = DataElement(xmlElemName.text,typeRef,parent=portInterface) if hasAdminData(xmlElem): dataElem.adminData=parseAdminDataNode(xmlElem.find('ADMIN-DATA')) if xmlElem.find('SW-DATA-DEF-PROPS'): for xmlItem in xmlElem.find('SW-DATA-DEF-PROPS/SW-ADDR-METHOD-REF'): dataElem.swAddrMethodRef.append(xmlItem.text) portInterface.dataElements.append(dataElem) return portInterface
def parseDataConstraint(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'DATA-CONSTR') name = xmlRoot.find("./SHORT-NAME").text rules = [] for xmlItem in xmlRoot.findall( './DATA-CONSTR-RULES/DATA-CONSTR-RULE/*'): if xmlItem.tag == 'INTERNAL-CONSTRS': lowerLimitXML = xmlItem.find('./LOWER-LIMIT') upperLimitXML = xmlItem.find('./UPPER-LIMIT') lowerLimit = parseTextNode(lowerLimitXML) upperLimit = parseTextNode(upperLimitXML) lowerLimitType = 'CLOSED' upperLimitType = 'CLOSED' if lowerLimitXML.attrib['INTERVAL-TYPE'] == 'OPEN': lowerLimitType = 'OPEN' if upperLimitXML.attrib['INTERVAL-TYPE'] == 'OPEN': upperLimitType = 'OPEN' try: lowerLimit = int(lowerLimit) except ValueError: lowerLimit = str(lowerLimit) try: upperLimit = int(upperLimit) except ValueError: upperLimit = str(upperLimit) rules.append({ 'type': 'internalConstraint', 'lowerLimit': lowerLimit, 'upperLimit': upperLimit, 'lowerLimitType': lowerLimitType, 'upperLimitType': upperLimitType, }) else: raise NotImplementedError(xmlItem.tag) elem = DataConstraint(name, rules, parent) if hasAdminData(xmlRoot): elem.adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) return elem
def parseSystem(self, xmlRoot, parent=None): """ parses <SYSTEM> """ assert (xmlRoot.tag == 'SYSTEM') xmlName = xmlRoot.find('SHORT-NAME') if xmlName is not None: system = System(parseTextNode(xmlName), parent) for xmlElem in xmlRoot.findall('./*'): if xmlElem.tag == 'SHORT-NAME': pass elif xmlElem.tag == 'ADMIN-DATA': system.adminData = parseAdminDataNode(xmlElem) elif xmlElem.tag == 'FIBEX-ELEMENT-REFS': self.parseFibexElementRefs(xmlElem, system) elif xmlElem.tag == 'MAPPING': self.parseSystemMapping(xmlElem, system) elif xmlElem.tag == 'MAPPINGS': for xmlChild in xmlElem.findall('./*'): if xmlChild.tag == 'SYSTEM-MAPPING': self.parseSystemMapping(xmlChild, system) else: raise NotImplementedError(xmlChild.tag) elif xmlElem.tag == 'SOFTWARE-COMPOSITION': self.parseSoftwareComposition(xmlElem, system) elif xmlElem.tag in ['DESC','CATEGORY','VARIATION-POINT',\ 'ECU-EXTRACT-VERSION','FIBEX-ELEMENTS',\ 'ROOT-SOFTWARE-COMPOSITIONS','SYSTEM-VERSION', 'CONTAINER-I-PDU-HEADER-BYTE-ORDER']: print("[SystemParser] unhandled: %s" % xmlElem.tag) pass else: raise NotImplementedError(xmlElem.tag) return system else: raise KeyError('expected to find <SHORT-NAME> inside <SYSTEM> tag')
def parseSystem(self,xmlRoot,parent=None): """ parses <SYSTEM> """ assert(xmlRoot.tag=='SYSTEM') xmlName = xmlRoot.find('SHORT-NAME') if xmlName is not None: system=System(parseTextNode(xmlName),parent) for xmlElem in xmlRoot.findall('./*'): if xmlElem.tag=='SHORT-NAME': pass elif xmlElem.tag=='ADMIN-DATA': system.adminData=parseAdminDataNode(xmlElem) elif xmlElem.tag=='FIBEX-ELEMENT-REFS': self.parseFibexElementRefs(xmlElem,system) elif xmlElem.tag=='MAPPING': self.parseSystemMapping(xmlElem,system) elif xmlElem.tag=='SOFTWARE-COMPOSITION': self.parseSoftwareComposition(xmlElem,system) else: raise NotImplementedError(xmlElem.tag) return system else: raise KeyError('expected to find <SHORT-NAME> inside <SYSTEM> tag')
def parseComponentPorts(self, componentType, xmlRoot): xmlPorts = xmlRoot.find('PORTS') assert (xmlPorts is not None) for xmlPort in xmlPorts.findall('*'): if (xmlPort.tag == "R-PORT-PROTOTYPE"): portName = xmlPort.find('SHORT-NAME').text portInterfaceRef = self.parseTextNode( xmlPort.find('REQUIRED-INTERFACE-TREF')) port = autosar.port.RequirePort(portName, portInterfaceRef, parent=componentType) if hasAdminData(xmlPort): port.adminData = parseAdminDataNode( xmlPort.find('ADMIN-DATA')) if xmlPort.findall('./REQUIRED-COM-SPECS') is not None: for xmlItem in xmlPort.findall('./REQUIRED-COM-SPECS/*'): if xmlItem.tag == 'CLIENT-COM-SPEC': operationName = _getOperationNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.OperationComSpec( operationName) port.comspec.append(comspec) elif xmlItem.tag == 'UNQUEUED-RECEIVER-COM-SPEC' or xmlItem.tag == 'NONQUEUED-RECEIVER-COM-SPEC': dataElemName = _getDataElemNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.DataElementComSpec( dataElemName) if xmlItem.find('./ALIVE-TIMEOUT') is not None: comspec.aliveTimeout = self.parseTextNode( xmlItem.find('./ALIVE-TIMEOUT')) if self.version >= 4.0: xmlElem = xmlItem.find('./INIT-VALUE') if xmlElem != None: for xmlChild in xmlElem.findall('./*'): if xmlChild.tag == 'CONSTANT-REFERENCE': comspec.initValueRef = self.parseTextNode( xmlChild.find( './CONSTANT-REF')) else: values = self.constant_parser.parseValueV4( xmlElem, None) if len(values) != 1: raise ValueError( 'INIT-VALUE cannot cannot contain multiple elements' ) comspec.initValue = values[0] else: if xmlItem.find('./INIT-VALUE-REF') != None: comspec.initValueRef = self.parseTextNode( xmlItem.find('./INIT-VALUE-REF')) port.comspec.append(comspec) elif xmlItem.tag == 'QUEUED-RECEIVER-COM-SPEC': dataElemName = _getDataElemNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.DataElementComSpec( dataElemName) if xmlItem.find('./QUEUE-LENGTH') != None: comspec.queueLength = self.parseTextNode( xmlItem.find('./QUEUE-LENGTH')) port.comspec.append(comspec) elif xmlItem.tag == 'MODE-SWITCH-RECEIVER-COM-SPEC': comspec = self._parseModeSwitchReceiverComSpec( xmlItem) port.comspec.append(comspec) elif xmlItem.tag == 'PARAMETER-REQUIRE-COM-SPEC': comspec = self._parseParameterComSpec( xmlItem, portInterfaceRef) port.comspec.append(comspec) else: raise NotImplementedError(xmlItem.tag) componentType.requirePorts.append(port) elif (xmlPort.tag == 'P-PORT-PROTOTYPE'): portName = xmlPort.find('SHORT-NAME').text portInterfaceRef = self.parseTextNode( xmlPort.find('PROVIDED-INTERFACE-TREF')) port = autosar.port.ProvidePort(portName, portInterfaceRef, parent=componentType) if hasAdminData(xmlPort): port.adminData = parseAdminDataNode( xmlPort.find('ADMIN-DATA')) if xmlPort.findall('./PROVIDED-COM-SPECS') is not None: for xmlItem in xmlPort.findall('./PROVIDED-COM-SPECS/*'): if xmlItem.tag == 'SERVER-COM-SPEC': operationName = _getOperationNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.OperationComSpec( operationName) comspec.queueLength = self.parseIntNode( xmlItem.find('QUEUE-LENGTH')) port.comspec.append(comspec) elif xmlItem.tag == 'UNQUEUED-SENDER-COM-SPEC' or xmlItem.tag == 'NONQUEUED-SENDER-COM-SPEC': dataElemName = _getDataElemNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.DataElementComSpec( dataElemName) if self.version >= 4.0: xmlElem = xmlItem.find('./INIT-VALUE') if xmlElem != None: for xmlChild in xmlElem.findall('./*'): if xmlChild.tag == 'CONSTANT-REFERENCE': comspec.initValueRef = self.parseTextNode( xmlChild.find( './CONSTANT-REF')) else: values = self.constant_parser.parseValueV4( xmlElem, None) if len(values) != 1: raise ValueError( 'INIT-VALUE cannot cannot contain multiple elements' ) comspec.initValue = values[0] else: if xmlItem.find( './INIT-VALUE-REF') is not None: comspec.initValueRef = self.parseTextNode( xmlItem.find('./INIT-VALUE-REF')) if xmlItem.find('./CAN-INVALIDATE') != None: comspec.canInvalidate = True if self.parseTextNode( xmlItem.find('./CAN-INVALIDATE') ) == 'true' else False port.comspec.append(comspec) elif xmlItem.tag == 'QUEUED-SENDER-COM-SPEC': dataElemName = _getDataElemNameFromComSpec( xmlItem, portInterfaceRef) comspec = autosar.port.DataElementComSpec( dataElemName) assert (comspec is not None) port.comspec.append(comspec) elif xmlItem.tag == 'PARAMETER-PROVIDE-COM-SPEC': comspec = self._parseParameterComSpec( xmlItem, portInterfaceRef) assert (comspec is not None) port.comspec.append(comspec) elif xmlItem.tag == 'MODE-SWITCH-SENDER-COM-SPEC': comspec = self._parseModeSwitchSenderComSpec( xmlItem) assert (comspec is not None) port.comspec.append(comspec) else: raise NotImplementedError(xmlItem.tag) componentType.providePorts.append(port)
def parseCompuMethod(self,xmlRoot,parent=None): assert (xmlRoot.tag == 'COMPU-METHOD') name = parseTextNode(xmlRoot.find("./SHORT-NAME")) category = parseTextNode(xmlRoot.find("./CATEGORY")) unitRef = xmlRoot.find("./UNIT-REF") semanticsType = None semanticElements=[] if hasAdminData(xmlRoot): adminData=parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) else: adminData=None xmlCompuScales = xmlRoot.findall('./COMPU-INTERNAL-TO-PHYS/COMPU-SCALES/COMPU-SCALE') if xmlCompuScales is None: raise NotImplementedError("No COMPU-SCALE? item=%s"%name) else: for xmlItem in xmlCompuScales: rational = xmlItem.find('./COMPU-RATIONAL-COEFFS') const = xmlItem.find('./COMPU-CONST') label = self.parseTextNode(xmlItem.find('./SHORT-LABEL')) mask = self.parseIntNode(xmlItem.find('./MASK')) symbol = self.parseTextNode(xmlItem.find('./SYMBOL')) if rational is not None: if (semanticsType is not None) and (semanticsType !='compuRational'): raise NotImplementedError('mixed compuscales not supported, item=%s'%name) else: semanticsType='compuRational' v=rational.findall('./COMPU-NUMERATOR/V') offset=v[0].text numerator=v[1].text denominator=rational.find('./COMPU-DENOMINATOR/V').text semanticElements.append({'offset':offset, 'numerator':numerator, 'denominator':denominator, 'label':label, 'symbol': symbol}) if const is not None: if (semanticsType is not None) and (semanticsType !='compuConst'): raise NotImplementedError('mixed compuscales not supported, item=%s'%name) else: semanticsType='compuConst' lowerLimit = parseTextNode(xmlItem.find('./LOWER-LIMIT')) upperLimit = parseTextNode(xmlItem.find('./UPPER-LIMIT')) textValue = parseTextNode(const.find('./VT')) semanticElements.append({'lowerLimit':int(lowerLimit),'upperLimit':int(upperLimit), 'textValue': textValue, 'label': label, 'symbol': symbol}) if mask is not None: if (semanticsType is not None) and (semanticsType !='compuMask'): raise NotImplementedError('mixed compuscales not supported, item=%s'%name) else: semanticsType='compuMask' lowerLimit = parseTextNode(xmlItem.find('./LOWER-LIMIT')) upperLimit = parseTextNode(xmlItem.find('./UPPER-LIMIT')) semanticElements.append({'lowerLimit':int(lowerLimit),'upperLimit':int(upperLimit), 'mask': mask, 'label': label, 'symbol': symbol}) if semanticsType == 'compuRational': if unitRef is not None: unitRef=unitRef.text method=CompuMethodRational(name, unitRef, semanticElements, category=category, adminData=adminData) return method elif semanticsType == 'compuConst': method = CompuMethodConst(name, semanticElements, category=category, adminData=adminData) return method elif semanticsType == 'compuMask': method = CompuMethodMask(name, semanticElements, category=category, adminData=adminData) return method else: raise ValueError("unprocessed semanticsType,item=%s"%name)
def parseInternalBehavior(self,xmlRoot,dummy,parent=None): xmlName = parseTextNode(xmlRoot.find('SHORT-NAME')) xmlComponentRef = parseTextNode(xmlRoot.find('COMPONENT-REF')) xmlSupportMultipleInst = xmlRoot.find('SUPPORTS-MULTIPLE-INSTANTIATION') ws = parent.rootWS() assert(ws is not None) if (xmlName is not None) and (xmlComponentRef is not None): multipleInstance = False if (xmlSupportMultipleInst is not None) and (xmlSupportMultipleInst.text == 'true'): multipleInstance = True internalBehavior = InternalBehavior(xmlName, xmlComponentRef, multipleInstance, parent) swc = ws.find(xmlComponentRef) if swc is not None: swc.behavior=internalBehavior for xmlNode in xmlRoot.findall('./*'): if (xmlNode.tag == 'SHORT-NAME') or (xmlNode.tag == 'COMPONENT-REF') or (xmlNode.tag == 'SUPPORTS-MULTIPLE-INSTANTIATION'): continue if xmlNode.tag == 'EVENTS': for xmlEvent in xmlNode.findall('./*'): event = None if xmlEvent.tag == 'MODE-SWITCH-EVENT': event = self.parseModeSwitchEvent(xmlEvent,internalBehavior) elif xmlEvent.tag == 'TIMING-EVENT': event = self.parseTimingEvent(xmlEvent,internalBehavior) elif xmlEvent.tag == 'DATA-RECEIVED-EVENT': event = self.parseDataReceivedEvent(xmlEvent,internalBehavior) elif xmlEvent.tag == 'OPERATION-INVOKED-EVENT': event = self.parseOperationInvokedEvent(xmlEvent,internalBehavior) else: raise NotImplementedError(xmlEvent.tag) if event is not None: internalBehavior.events.append(event) else: raise ValueError('event') elif xmlNode.tag == 'PORT-API-OPTIONS': for xmlOption in xmlNode.findall('./PORT-API-OPTION'): portAPIOption = PortAPIOption(parseTextNode(xmlOption.find('PORT-REF')),parseBooleanNode(xmlOption.find('ENABLE-TAKE-ADDRESS')),parseBooleanNode(xmlOption.find('INDIRECT-API'))) if portAPIOption is not None: internalBehavior.portAPIOptions.append(portAPIOption) elif xmlNode.tag == 'RUNNABLES': for xmRunnable in xmlNode.findall('./RUNNABLE-ENTITY'): xmlDataReceivePoints=None xmlDataSendPoints=None xmlServerCallPoints=None xmlCanEnterExclusiveAreas=None adminData = None for xmlElem in xmRunnable.findall('*'): if xmlElem.tag=='SHORT-NAME': name=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-BE-INVOKED-CONCURRENTLY': canBeInvokedConcurrently=parseBooleanNode(xmlElem) elif xmlElem.tag=='DATA-RECEIVE-POINTS': xmlDataReceivePoints=xmlElem elif xmlElem.tag=='DATA-SEND-POINTS': xmlDataSendPoints=xmlElem elif xmlElem.tag=='SERVER-CALL-POINTS': xmlServerCallPoints=xmlElem elif xmlElem.tag=='SYMBOL': symbol=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-ENTER-EXCLUSIVE-AREA-REFS': xmlCanEnterExclusiveAreas=xmlElem elif xmlElem.tag=='ADMIN-DATA': adminData=parseAdminDataNode(xmlElem) else: raise NotImplementedError(xmlElem.tag) runnableEntity = RunnableEntity(name, canBeInvokedConcurrently, symbol, parent=internalBehavior) if xmlDataReceivePoints is not None: for xmlDataPoint in xmlDataReceivePoints.findall('./DATA-RECEIVE-POINT'): name=parseTextNode(xmlDataPoint.find('SHORT-NAME')) dataElementInstanceRef = self.parseDataElementInstanceRef(xmlDataPoint.find('DATA-ELEMENT-IREF'),'R-PORT-PROTOTYPE-REF') if dataElementInstanceRef is not None: dataReceivePoint=DataReceivePoint(dataElementInstanceRef.portRef,dataElementInstanceRef.dataElemRef,name) runnableEntity.append(dataReceivePoint) if xmlDataSendPoints is not None: for xmlDataPoint in xmlDataSendPoints.findall('./DATA-SEND-POINT'): name=parseTextNode(xmlDataPoint.find('SHORT-NAME')) dataElementInstanceRef = self.parseDataElementInstanceRef(xmlDataPoint.find('DATA-ELEMENT-IREF'),'P-PORT-PROTOTYPE-REF') if dataElementInstanceRef is not None: dataSendPoint=DataSendPoint(dataElementInstanceRef.portRef,dataElementInstanceRef.dataElemRef,name) runnableEntity.append(dataSendPoint) if xmlServerCallPoints is not None: for xmlServerCallPoint in xmlServerCallPoints.findall('./SYNCHRONOUS-SERVER-CALL-POINT'): syncServerCallPoint = self.parseSyncServerCallPoint(xmlServerCallPoint) if syncServerCallPoint is not None: runnableEntity.serverCallPoints.append(syncServerCallPoint) if xmlCanEnterExclusiveAreas is not None: for xmlCanEnterExclusiveAreaRef in xmlCanEnterExclusiveAreas.findall('./CAN-ENTER-EXCLUSIVE-AREA-REF'): runnableEntity.exclusiveAreaRefs.append(parseTextNode(xmlCanEnterExclusiveAreaRef)) if runnableEntity is not None: runnableEntity.adminData = adminData internalBehavior.runnables.append(runnableEntity) elif xmlNode.tag == 'PER-INSTANCE-MEMORYS': for xmlElem in xmlNode.findall('./PER-INSTANCE-MEMORY'): perInstanceMemory = PerInstanceMemory(parseTextNode(xmlElem.find('SHORT-NAME')),parseTextNode(xmlElem.find('TYPE-DEFINITION')), internalBehavior) if perInstanceMemory is not None: internalBehavior.perInstanceMemories.append(perInstanceMemory) elif xmlNode.tag == 'SERVICE-NEEDSS': for xmlElem in xmlNode.findall('./*'): if xmlElem.tag=='SWC-NV-BLOCK-NEEDS': swcNvBlockNeeds=self.parseSwcNvBlockNeeds(xmlElem) if swcNvBlockNeeds is not None: internalBehavior.swcNvBlockNeeds.append(swcNvBlockNeeds) else: raise NotImplementedError(xmlElem.tag) elif xmlNode.tag == 'SHARED-CALPRMS': for xmlElem in xmlNode.findall('./*'): if xmlElem.tag=='CALPRM-ELEMENT-PROTOTYPE': calPrmElemPrototype=self.parseCalPrmElemPrototype(xmlElem, internalBehavior) assert(calPrmElemPrototype is not None) internalBehavior.sharedCalParams.append(calPrmElemPrototype) else: raise NotImplementedError(xmlElem.tag) elif xmlNode.tag == 'EXCLUSIVE-AREAS': for xmlElem in xmlNode.findall('./*'): if xmlElem.tag=='EXCLUSIVE-AREA': exclusiveArea=ExclusiveArea(parseTextNode(xmlElem.find('SHORT-NAME')), internalBehavior) internalBehavior.exclusiveAreas.append(exclusiveArea) else: raise NotImplementedError(xmlElem.tag) else: raise NotImplementedError(xmlNode.tag) return internalBehavior
def parseCompuMethod(self, xmlRoot, parent=None): assert (xmlRoot.tag == 'COMPU-METHOD') name = parseTextNode(xmlRoot.find("./SHORT-NAME")) category = parseTextNode(xmlRoot.find("./CATEGORY")) unitRef = xmlRoot.find("./UNIT-REF") semanticsType = None semanticElements = [] if hasAdminData(xmlRoot): adminData = parseAdminDataNode(xmlRoot.find('ADMIN-DATA')) else: adminData = None xmlCompuScales = xmlRoot.findall( './COMPU-INTERNAL-TO-PHYS/COMPU-SCALES/COMPU-SCALE') if xmlCompuScales is None: raise NotImplementedError("No COMPU-SCALE? item=%s" % name) else: for xmlItem in xmlCompuScales: rational = xmlItem.find('./COMPU-RATIONAL-COEFFS') const = xmlItem.find('./COMPU-CONST') label = self.parseTextNode(xmlItem.find('./SHORT-LABEL')) mask = self.parseIntNode(xmlItem.find('./MASK')) symbol = self.parseTextNode(xmlItem.find('./SYMBOL')) if rational is not None: if (semanticsType is not None) and (semanticsType != 'compuRational'): raise NotImplementedError( 'mixed compuscales not supported, item=%s' % name) else: semanticsType = 'compuRational' v = rational.findall('./COMPU-NUMERATOR/V') offset = v[0].text numerator = v[1].text denominator = rational.find( './COMPU-DENOMINATOR/V').text semanticElements.append({ 'offset': offset, 'numerator': numerator, 'denominator': denominator, 'label': label, 'symbol': symbol }) if const is not None: if (semanticsType is not None) and (semanticsType != 'compuConst'): raise NotImplementedError( 'mixed compuscales not supported, item=%s' % name) else: semanticsType = 'compuConst' lowerLimit = parseTextNode( xmlItem.find('./LOWER-LIMIT')) upperLimit = parseTextNode( xmlItem.find('./UPPER-LIMIT')) textValue = parseTextNode(const.find('./VT')) semanticElements.append({ 'lowerLimit': int(lowerLimit), 'upperLimit': int(upperLimit), 'textValue': textValue, 'label': label, 'symbol': symbol }) if mask is not None: if (semanticsType is not None) and (semanticsType != 'compuMask'): raise NotImplementedError( 'mixed compuscales not supported, item=%s' % name) else: semanticsType = 'compuMask' lowerLimit = parseTextNode( xmlItem.find('./LOWER-LIMIT')) upperLimit = parseTextNode( xmlItem.find('./UPPER-LIMIT')) semanticElements.append({ 'lowerLimit': int(lowerLimit), 'upperLimit': int(upperLimit), 'mask': mask, 'label': label, 'symbol': symbol }) if semanticsType == 'compuRational': if unitRef is not None: unitRef = unitRef.text method = CompuMethodRational(name, unitRef, semanticElements, category=category, adminData=adminData) return method elif semanticsType == 'compuConst': method = CompuMethodConst(name, semanticElements, category=category, adminData=adminData) return method elif semanticsType == 'compuMask': method = CompuMethodMask(name, semanticElements, category=category, adminData=adminData) return method else: raise ValueError("unprocessed semanticsType,item=%s" % name)
def parseRunnableEntity(self, xmlRoot, parent): xmlDataReceivePoints=None xmlDataSendPoints=None xmlServerCallPoints=None xmlCanEnterExclusiveAreas=None adminData = None xmlModeAccessPoints = None xmlParameterAccessPoints = None if self.version < 4.0: for xmlElem in xmlRoot.findall('*'): if xmlElem.tag=='SHORT-NAME': name=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-BE-INVOKED-CONCURRENTLY': canBeInvokedConcurrently=parseBooleanNode(xmlElem) elif xmlElem.tag=='DATA-RECEIVE-POINTS': xmlDataReceivePoints=xmlElem elif xmlElem.tag=='DATA-SEND-POINTS': xmlDataSendPoints=xmlElem elif xmlElem.tag=='SERVER-CALL-POINTS': xmlServerCallPoints=xmlElem elif xmlElem.tag=='SYMBOL': symbol=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-ENTER-EXCLUSIVE-AREA-REFS': xmlCanEnterExclusiveAreas=xmlElem elif xmlElem.tag=='ADMIN-DATA': adminData=parseAdminDataNode(xmlElem) else: raise NotImplementedError(xmlElem.tag) else: for xmlElem in xmlRoot.findall('*'): if xmlElem.tag=='SHORT-NAME': name=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-BE-INVOKED-CONCURRENTLY': canBeInvokedConcurrently=parseBooleanNode(xmlElem) elif xmlElem.tag == 'MODE-ACCESS-POINTS': xmlModeAccessPoints = xmlElem elif xmlElem.tag=='DATA-RECEIVE-POINT-BY-ARGUMENTS': xmlDataReceivePoints=xmlElem elif xmlElem.tag=='DATA-SEND-POINTS': xmlDataSendPoints=xmlElem elif xmlElem.tag=='SERVER-CALL-POINTS': xmlServerCallPoints=xmlElem elif xmlElem.tag=='SYMBOL': symbol=parseTextNode(xmlElem) elif xmlElem.tag=='CAN-ENTER-EXCLUSIVE-AREA-REFS': xmlCanEnterExclusiveAreas=xmlElem elif xmlElem.tag == 'MINIMUM-START-INTERVAL': pass #not implemented elif xmlElem.tag =='ADMIN-DATA': adminData=parseAdminDataNode(xmlElem) elif xmlElem.tag == 'PARAMETER-ACCESSS': xmlParameterAccessPoints = xmlElem else: raise NotImplementedError(xmlElem.tag) runnableEntity = RunnableEntity(name, canBeInvokedConcurrently, symbol, parent) if xmlDataReceivePoints is not None: if self.version < 4.0: for xmlDataPoint in xmlDataReceivePoints.findall('./DATA-RECEIVE-POINT'): name=parseTextNode(xmlDataPoint.find('SHORT-NAME')) dataElementInstanceRef = self.parseDataElementInstanceRef(xmlDataPoint.find('DATA-ELEMENT-IREF'),'R-PORT-PROTOTYPE-REF') if dataElementInstanceRef is not None: dataReceivePoint=DataReceivePoint(dataElementInstanceRef.portRef,dataElementInstanceRef.dataElemRef,name) runnableEntity.append(dataReceivePoint) else: for xmlVariableAcess in xmlDataReceivePoints.findall('VARIABLE-ACCESS'): name=parseTextNode(xmlVariableAcess.find('SHORT-NAME')) accessedVariable = self.parseAccessedVariable(xmlVariableAcess.find('./ACCESSED-VARIABLE')) assert(accessedVariable is not None) dataReceivePoint=DataReceivePoint(accessedVariable.portPrototypeRef,accessedVariable.targetDataPrototypeRef,name) runnableEntity.append(dataReceivePoint) if xmlDataSendPoints is not None: if self.version < 4.0: for xmlDataPoint in xmlDataSendPoints.findall('./DATA-SEND-POINT'): name=parseTextNode(xmlDataPoint.find('SHORT-NAME')) dataElementInstanceRef = self.parseDataElementInstanceRef(xmlDataPoint.find('DATA-ELEMENT-IREF'),'P-PORT-PROTOTYPE-REF') if dataElementInstanceRef is not None: dataSendPoint=DataSendPoint(dataElementInstanceRef.portRef,dataElementInstanceRef.dataElemRef,name) runnableEntity.append(dataSendPoint) else: for xmlVariableAcess in xmlDataSendPoints.findall('VARIABLE-ACCESS'): name=parseTextNode(xmlVariableAcess.find('SHORT-NAME')) accessedVariable = self.parseAccessedVariable(xmlVariableAcess.find('./ACCESSED-VARIABLE')) assert(accessedVariable is not None) dataSendPoint=DataSendPoint(accessedVariable.portPrototypeRef,accessedVariable.targetDataPrototypeRef,name) runnableEntity.append(dataSendPoint) if xmlModeAccessPoints is not None: for xmlElem in xmlModeAccessPoints.findall('./*'): if xmlElem.tag == 'MODE-ACCESS-POINT': modeAccessPoint = self.parseModeAccessPoint(xmlElem) assert(modeAccessPoint is not None) runnableEntity.modeAccessPoints.append(modeAccessPoint) else: raise NotImplementedError(xmlElem.tag) if xmlServerCallPoints is not None: for xmlServerCallPoint in xmlServerCallPoints.findall('./SYNCHRONOUS-SERVER-CALL-POINT'): syncServerCallPoint = self.parseSyncServerCallPoint(xmlServerCallPoint) if syncServerCallPoint is not None: runnableEntity.serverCallPoints.append(syncServerCallPoint) if xmlCanEnterExclusiveAreas is not None: for xmlCanEnterExclusiveAreaRef in xmlCanEnterExclusiveAreas.findall('./CAN-ENTER-EXCLUSIVE-AREA-REF'): runnableEntity.exclusiveAreaRefs.append(parseTextNode(xmlCanEnterExclusiveAreaRef)) if self.version >= 4.0 and xmlParameterAccessPoints is not None: for xmlChild in xmlParameterAccessPoints.findall('./*'): if xmlChild.tag == 'PARAMETER-ACCESS': tmp = self.parseParameterAccessPoint(xmlChild, runnableEntity) if tmp is not None: runnableEntity.parameterAccessPoints.append(tmp) else: raise NotImplementedError('xmlChild.tag') if runnableEntity is not None: runnableEntity.adminData = adminData return runnableEntity