How to use the opcua.ua.AddNodesItem function in opcua

To help you get started, we’ve selected a few opcua examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part3.py View on Github external
value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
    ref.SourceNodeId = ua.NodeId.from_string("i=12169")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=78")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=3068")
    node.BrowseName = ua.QualifiedName.from_string("NodeVersion")
    node.NodeClass = ua.NodeClass.Variable
    node.TypeDefinition = ua.NodeId.from_string("i=68")
    attrs = ua.VariableAttributes()
    attrs.Description = ua.LocalizedText("The version number of the node (used to indicate changes to references of the owning node).")
    attrs.DisplayName = ua.LocalizedText("NodeVersion")
    attrs.DataType = ua.NodeId(ua.ObjectIds.String)
    attrs.ValueRank = -2
    node.NodeAttributes = attrs
    server.add_nodes([node])
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=12170")
    node.BrowseName = ua.QualifiedName.from_string("ViewVersion")
    node.NodeClass = ua.NodeClass.Variable
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part3.py View on Github external
attrs = ua.DataTypeAttributes()
    attrs.Description = ua.LocalizedText("Describes a 128-bit decimal value.")
    attrs.DisplayName = ua.LocalizedText("Decimal128")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
    ref.SourceNodeId = ua.NodeId.from_string("i=121")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=26")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=31")
    node.BrowseName = ua.QualifiedName.from_string("References")
    node.NodeClass = ua.NodeClass.ReferenceType
    attrs = ua.ReferenceTypeAttributes()
    attrs.Description = ua.LocalizedText("The abstract base type for all references.")
    attrs.DisplayName = ua.LocalizedText("References")
    attrs.InverseName = ua.LocalizedText("References")
    attrs.IsAbstract = True
    attrs.Symmetric = True
    node.NodeAttributes = attrs
    server.add_nodes([node])
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=32")
    node.BrowseName = ua.QualifiedName.from_string("NonHierarchicalReferences")
    node.NodeClass = ua.NodeClass.ReferenceType
github FreeOpcUa / python-opcua / opcua / common / instantiate.py View on Github external
def _instantiate_node(server,
                      node_type,
                      parentid,
                      rdesc,
                      nodeid,
                      bname,
                      dname=None,
                      recursive=True,
                      instantiate_optional=True):
    """
    instantiate a node type under parent
    """
    addnode = ua.AddNodesItem()
    addnode.RequestedNewNodeId = nodeid
    addnode.BrowseName = bname
    addnode.ParentNodeId = parentid
    addnode.ReferenceTypeId = rdesc.ReferenceTypeId
    addnode.TypeDefinition = rdesc.TypeDefinition

    if rdesc.NodeClass in (ua.NodeClass.Object, ua.NodeClass.ObjectType):
        addnode.NodeClass = ua.NodeClass.Object
        _read_and_copy_attrs(node_type, ua.ObjectAttributes(), addnode)

    elif rdesc.NodeClass in (ua.NodeClass.Variable, ua.NodeClass.VariableType):
        addnode.NodeClass = ua.NodeClass.Variable
        _read_and_copy_attrs(node_type, ua.VariableAttributes(), addnode)
    elif rdesc.NodeClass in (ua.NodeClass.Method, ):
        addnode.NodeClass = ua.NodeClass.Method
        _read_and_copy_attrs(node_type, ua.MethodAttributes(), addnode)
github FreeOpcUa / opcua-asyncio / opcua / common / instanciate.py View on Github external
def _instanciate_node(server, parentid, rdesc, idx):
    """
    Instanciate a new node under 'parent' using a type
    """

    print("Instanciating: node %s in %s" % (rdesc, parentid))
    addnode = ua.AddNodesItem()
    addnode.RequestedNewNodeId = ua.NodeId()
    addnode.BrowseName = rdesc.BrowseName
    addnode.NodeClass = rdesc.NodeClass
    addnode.ParentNodeId = parentid
    addnode.ReferenceTypeId = ua.TwoByteNodeId(ua.ObjectIds.HasComponent)
    addnode.TypeDefinition = rdesc.TypeDefinition
    print("ADDNODE", addnode)

    node_type = Node(server, rdesc.NodeId)

    if rdesc.NodeClass in (ua.NodeClass.Object, ua.NodeClass.ObjectType):
        print(node_type, " is object")
        _read_and_copy_attrs(node_type, ua.ObjectAttributes(), addnode)
        #_add_object_attrs(addnode, rdesc, node_type)

    elif rdesc.NodeClass in (ua.NodeClass.Variable, ua.NodeClass.VariableType):
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part3.py View on Github external
attrs = ua.DataTypeAttributes()
    attrs.Description = ua.LocalizedText("A period of time formatted as defined in ISO 8601-2000.")
    attrs.DisplayName = ua.LocalizedText("DurationString")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
    ref.SourceNodeId = ua.NodeId.from_string("i=12879")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=12")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=12880")
    node.BrowseName = ua.QualifiedName.from_string("TimeString")
    node.NodeClass = ua.NodeClass.DataType
    node.ParentNodeId = ua.NodeId.from_string("i=12")
    node.ReferenceTypeId = ua.NodeId.from_string("i=45")
    attrs = ua.DataTypeAttributes()
    attrs.Description = ua.LocalizedText("A time formatted as defined in ISO 8601-2000.")
    attrs.DisplayName = ua.LocalizedText("TimeString")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
    ref.SourceNodeId = ua.NodeId.from_string("i=12880")
    ref.TargetNodeClass = ua.NodeClass.DataType
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part3.py View on Github external
attrs.Description = ua.LocalizedText("Describes a value that is an enumerated DataType.")
    attrs.DisplayName = ua.LocalizedText("Enumeration")
    attrs.IsAbstract = True
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
    ref.SourceNodeId = ua.NodeId.from_string("i=29")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=24")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=1")
    node.BrowseName = ua.QualifiedName.from_string("Boolean")
    node.NodeClass = ua.NodeClass.DataType
    node.ParentNodeId = ua.NodeId.from_string("i=24")
    node.ReferenceTypeId = ua.NodeId.from_string("i=45")
    attrs = ua.DataTypeAttributes()
    attrs.Description = ua.LocalizedText("Describes a value that is either TRUE or FALSE.")
    attrs.DisplayName = ua.LocalizedText("Boolean")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
    ref.SourceNodeId = ua.NodeId.from_string("i=1")
    ref.TargetNodeClass = ua.NodeClass.DataType
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part11.py View on Github external
attrs.DisplayName = ua.LocalizedText("StartOfOnlineArchive")
    attrs.DataType = ua.NodeId.from_string("i=294")
    attrs.ValueRank = -1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
    ref.SourceNodeId = ua.NodeId.from_string("i=11500")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=80")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=11202")
    node.BrowseName = ua.QualifiedName.from_string("HA Configuration")
    node.NodeClass = ua.NodeClass.Object
    node.TypeDefinition = ua.NodeId.from_string("i=2318")
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = ua.LocalizedText("HA Configuration")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
    ref.SourceNodeId = ua.NodeId.from_string("i=11202")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=11203")
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part4.py View on Github external
attrs = ua.ObjectAttributes()
    attrs.DisplayName = ua.LocalizedText("Default XML")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=39")
    ref.SourceNodeId = ua.NodeId.from_string("i=383")
    ref.TargetNodeClass = ua.NodeClass.DataType
    ref.TargetNodeId = ua.NodeId.from_string("i=8369")
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=386")
    node.BrowseName = ua.QualifiedName.from_string("Default XML")
    node.NodeClass = ua.NodeClass.Object
    node.ParentNodeId = ua.NodeId.from_string("i=385")
    node.ReferenceTypeId = ua.NodeId.from_string("i=38")
    node.TypeDefinition = ua.NodeId.from_string("i=76")
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = ua.LocalizedText("Default XML")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=39")
    ref.SourceNodeId = ua.NodeId.from_string("i=386")
github FreeOpcUa / python-opcua / opcua / server / standard_address_space / standard_address_space_part3.py View on Github external
attrs.DisplayName = ua.LocalizedText("LocaleId")
    node.NodeAttributes = attrs
    server.add_nodes([node])
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=8912")
    node.BrowseName = ua.QualifiedName.from_string("TimeZoneDataType")
    node.NodeClass = ua.NodeClass.DataType
    node.ParentNodeId = ua.NodeId.from_string("i=22")
    node.ReferenceTypeId = ua.NodeId.from_string("i=45")
    attrs = ua.DataTypeAttributes()
    attrs.DisplayName = ua.LocalizedText("TimeZoneDataType")
    node.NodeAttributes = attrs
    server.add_nodes([node])
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = ua.NodeId.from_string("i=297")
    node.BrowseName = ua.QualifiedName.from_string("Default XML")
    node.NodeClass = ua.NodeClass.Object
    node.ParentNodeId = ua.NodeId.from_string("i=296")
    node.ReferenceTypeId = ua.NodeId.from_string("i=38")
    node.TypeDefinition = ua.NodeId.from_string("i=76")
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = ua.LocalizedText("Default XML")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = ua.NodeId.from_string("i=39")
    ref.SourceNodeId = ua.NodeId.from_string("i=297")