Skip to content

Import of custom NodeSet causes some Nodes to be readonly #1839

Open
@Frozenbitz

Description

@Frozenbitz

Hello,

i'm building custom NodeSets for testing different OPC UA stacks for a simulation. I currently have the issue, that my recent models fail to correctly load into the server to access the variables needed for the simulation.

I found the models to be working with open62541, the UA ReferenceStack and Node-OPCUA. I would like to confirm wether this is an issue with the model generation (or the models), if there is an issue with the XML importer or wether i am missing the proper instantiation required to load the models into the server.

Describe the bug

The required variables should be exposed writable and accessable, however on import through load_xml the UserAccessLevel of the entire session is dropped to "CurrentRead". I believe i am having issues with the XML import of the model, since the value attributes for custom variables are not even accessible after import. Custom Properties are not affected by this for some reason.
An example of a broken Variable Type:

Image

To run the server i am using poetry, docker and UA Model Compiler to generate my files.
For generation i used the Schema linked in the Submodules: Ref

I tried crosschecking the generated files using the available schema files from the foundation using xmllint:

xmllint --noout --schema Opc.Ua.ModelDesign.xsd Model.xml
xmllint --noout --schema UANodeSetv105.xsd Reference.NodeSet2.xml

I did get a single warning for the models:

/model/input/TankModel.xml:255: element Children: Schemas validity error : Element '{http://opcfoundation.org/UA/ModelDesign.xsd}Children': This element is not expected.

For the other OPC stacks this did not cause any issue so far.

To Reproduce

I ran some of the provided examples to test my import issues. Mainly server-woodworking and server-robotics.
I just changed the import to use the custom files. The provided models do not require DI or any other models as a dependency.
I added one of the model files+NodeSet2 here: https://gist.github.com/Frozenbitz/1506cfdbd097cc7819275b50aba80d25
A note on the publication date: I did have issues with the publication date generated by UA Model Compiler. Currently the import fails because the original files are missing the publication date key, which i usually manually add. I did not find a way to edit how the compiler generates the required model definitions to use the dates from the provided files.

<Model ModelUri="urn:open62541.server.application" Version="1.05.02" PublicationDate="2024-04-12T00:00:00Z" ModelVersion="1.5.2">
      <RequiredModel ModelUri="http://opcfoundation.org/UA/" XmlSchemaUri="http://opcfoundation.org/UA/2008/02/Types.xsd" PublicationDate="2024-04-12T00:00:00Z" />
    </Model>

To setup a simple server:

def __init__(self, endpoint, name, model_filepath):
        self.server = Server()

        self.model_filepath = model_filepath
        self.server.set_server_name(name)
        self.server.set_endpoint(endpoint)

    async def init(self):
        await self.server.init()

        #  This need to be imported at the start or else it will overwrite the data
        #await self.server.import_xml(os.path.join(self.model_filepath, "../nodeset/DI/Opc.Ua.Di.NodeSet2.xml"))
        await self.server.import_xml(
            os.path.join(self.model_filepath, "/devel/meta/demo-nodeset2/Tank.NodeSet2.xml")
        )
....

Logging on Startup:

INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18979, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18974, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18981, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18980, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18982, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18980, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18983, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18980, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18984, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18980, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18989, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18988, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
INFO:asyncua.server.address_space:add_node: while adding node NumericNodeId(Identifier=18990, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>), requested parent node NumericNodeId(Identifier=18988, NamespaceIndex=0, NodeIdType=<NodeIdType.Numeric: 2>) does not exists
...
INFO:asyncua.common.xmlimporter:Importing XML file /devel/modules/model-compiler/output/KRITIS3M.Reference.NodeSet2.xml
INFO:asyncua.common.xmlimporter:namespace map: {1: 2}
INFO:asyncua.common.xmlimporter:Importing xml node (QualifiedName(NamespaceIndex=2, Name='DeviceInfoType'), NodeId(Identifier=1, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>)) as (QualifiedName(NamespaceIndex=2, Name='DeviceInfoType') NodeId(Identifier=1, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>))
INFO:asyncua.common.xmlimporter:Importing xml node (QualifiedName(NamespaceIndex=2, Name='DeviceID'), NodeId(Identifier=2, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>)) as (QualifiedName(NamespaceIndex=2, Name='DeviceID') NodeId(Identifier=2, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>))
INFO:asyncua.common.xmlimporter:Importing xml node (QualifiedName(NamespaceIndex=2, Name='Location'), NodeId(Identifier=3, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>)) as (QualifiedName(NamespaceIndex=2, Name='Location') NodeId(Identifier=3, NamespaceIndex=2, NodeIdType=<NodeIdType.Numeric: 2>))
...
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='NamespaceFile') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='DefaultRolePermissions') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='DefaultUserRolePermissions') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='DefaultAccessRestrictions') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='ConfigurationVersion') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')
INFO:asyncua.common.instantiate_util:Instantiate: Skip optional node QualifiedName(NamespaceIndex=0, Name='ModelVersion') as part of QualifiedName(NamespaceIndex=2, Name='urn:open62541.server.application')

Expected behavior

The server should start and accept client sessions with "CurrentRead" and "CurrentWrite" enabled.

Version

Python-Version: 3.10, 3.11, 3.12 (tested with Docker and python-base)

opcua-asyncio Version master, 1.6, 1.4:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions