How to use the asyncua.ua.QualifiedName function in asyncua

To help you get started, we’ve selected a few asyncua 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 / opcua-asyncio / tests / tests_common.py View on Github external
def test_add_string_variable(self):
        objects = self.opc.get_objects_node()
        v = objects.add_variable('ns=3;s=stringid;', '3:stringnodefromstring', [68])
        nid = ua.NodeId('stringid', 3)
        qn = ua.QualifiedName('stringnodefromstring', 3)
        self.assertEqual(nid, v.nodeid)
        self.assertEqual(qn, v.get_browse_name())
github FreeOpcUa / opcua-asyncio / tests / test_custom_structures.py View on Github external
n = srv.srv.get_node(srv.dict_builder.dict_id)
    desc_node = await n.get_child(f"{srv.dict_builder._idx}:{type_name}")
    assert await desc_node.get_browse_name() == ua.QualifiedName(type_name, srv.idx)
    assert await desc_node.get_node_class() == ua.NodeClass.Variable
    assert (await desc_node.get_parent()).nodeid == srv.dict_builder.dict_id
    assert ua.NodeId(ua.ObjectIds.HasComponent, 0) == (await desc_node.get_references(refs=ua.ObjectIds.HasComponent))[0].ReferenceTypeId
    assert await desc_node.get_type_definition() == ua.NodeId(ua.ObjectIds.DataTypeDescriptionType, 0)

    assert await desc_node.get_display_name() == ua.LocalizedText(type_name)
    assert await desc_node.get_data_type() == ua.NodeId(ua.ObjectIds.String)
    assert await desc_node.get_value() == type_name
    assert await desc_node.get_value_rank() == -1

    # Test object node
    obj_node = (await type_node.get_children(refs=ua.ObjectIds.HasEncoding))[0]
    assert await obj_node.get_browse_name() == ua.QualifiedName('Default Binary', 0)
    assert await obj_node.get_node_class() == ua.NodeClass.Object
    assert (await obj_node.get_references(refs=ua.ObjectIds.HasEncoding))[0].NodeId == type_node.nodeid
    assert ua.NodeId(ua.ObjectIds.HasEncoding, 0) == (await obj_node.get_references(refs=ua.ObjectIds.HasEncoding))[0].ReferenceTypeId
    assert await obj_node.get_type_definition() == ua.NodeId(ua.ObjectIds.DataTypeEncodingType, 0)
    assert await obj_node.get_display_name() == ua.LocalizedText('Default Binary')
    assert len(await obj_node.get_event_notifier()) == 0

    # Test links, three were tested above
    struct_node = srv.srv.get_node(ua.NodeId(ua.ObjectIds.Structure, 0))
    struct_children = await struct_node.get_children(refs=ua.ObjectIds.HasSubtype)
    assert type_node in struct_children
    dict_node = srv.srv.get_node(srv.dict_builder.dict_id)
    dict_children = await dict_node.get_children(refs=ua.ObjectIds.HasComponent)
    assert desc_node in dict_children
    assert obj_node in await type_node.get_children(ua.ObjectIds.HasEncoding)
    assert desc_node in await obj_node.get_children(refs=ua.ObjectIds.HasDescription)
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part11.py View on Github external
ref.SourceNodeId = NumericNodeId(3034, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(3034, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(3014, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(3019, 0)
    node.BrowseName = QualifiedName('AuditHistoryAtTimeDeleteEventType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(3012, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("AuditHistoryAtTimeDeleteEventType")
    attrs.IsAbstract = True
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(3019, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(3020, 0)
    refs.append(ref)
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part11.py View on Github external
ref.SourceNodeId = NumericNodeId(3023, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(3023, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(3022, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(3024, 0)
    node.BrowseName = QualifiedName('OldValues', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(3022, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OldValues")
    attrs.DataType = NumericNodeId(920, 0)
    attrs.ValueRank = -1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(3024, 0)
    ref.TargetNodeClass = NodeClass.DataType
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part11.py View on Github external
attrs.ValueRank = -2
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(11215, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(2330, 0)
    node.BrowseName = QualifiedName('HistoryServerCapabilitiesType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(58, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("HistoryServerCapabilitiesType")
    attrs.IsAbstract = False
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(2330, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2331, 0)
    refs.append(ref)
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part13.py View on Github external
attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(11286, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2340, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(11287, 0)
    node.BrowseName = QualifiedName('Maximum2', 0)
    node.NodeClass = NodeClass.Object
    node.TypeDefinition = NumericNodeId(2340, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Maximum2")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(11287, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2340, 0)
    refs.append(ref)
    server.add_references(refs)
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part8.py View on Github external
ref.SourceNodeId = NumericNodeId(17570, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(17575, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(17570, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2368, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(17575, 0)
    node.BrowseName = QualifiedName('EngineeringUnits', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(17570, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("EngineeringUnits")
    attrs.DataType = NumericNodeId(887, 0)
    attrs.ValueRank = -1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(17575, 0)
    ref.TargetNodeClass = NodeClass.DataType
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part11.py View on Github external
ref.SourceNodeId = NumericNodeId(2332, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(2332, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2330, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(11268, 0)
    node.BrowseName = QualifiedName('MaxReturnDataValues', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(2330, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("MaxReturnDataValues")
    attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
    attrs.ValueRank = -1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(11268, 0)
    ref.TargetNodeClass = NodeClass.DataType
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part11.py View on Github external
ref.SourceNodeId = NumericNodeId(3028, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(3028, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2999, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(3003, 0)
    node.BrowseName = QualifiedName('Filter', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(2999, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("Filter")
    attrs.DataType = NumericNodeId(725, 0)
    attrs.ValueRank = -1
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(3003, 0)
    ref.TargetNodeClass = NodeClass.DataType
github FreeOpcUa / opcua-asyncio / asyncua / server / standard_address_space / standard_address_space_part13.py View on Github external
attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(2348, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2340, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(2349, 0)
    node.BrowseName = QualifiedName('MaximumActualTime', 0)
    node.NodeClass = NodeClass.Object
    node.TypeDefinition = NumericNodeId(2340, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("MaximumActualTime")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(2349, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(2340, 0)
    refs.append(ref)
    server.add_references(refs)