Ejemplo n.º 1
0
async def test_xml_ext_obj_array(opc, tmpdir):
    arg = ua.Argument()
    arg.DataType = ua.NodeId(ua.ObjectIds.Float)
    arg.Description = ua.LocalizedText("Nice description")
    arg.ArrayDimensions = [1, 2, 3]
    arg.Name = "MyArg"
    arg2 = ua.Argument()
    arg2.DataType = ua.NodeId(ua.ObjectIds.Int32)
    arg2.Description = ua.LocalizedText("Nice description2")
    arg2.ArrayDimensions = [4, 5, 6]
    arg2.Name = "MyArg2"
    args = [arg, arg2]
    node = await opc.opc.nodes.objects.add_variable(2, "xmlexportobj2", args)
    node2 = await _test_xml_var_type(opc,
                                     tmpdir,
                                     node,
                                     "ext_obj_array",
                                     test_equality=False)
    read_args = await node2.read_value()
    for i, arg in enumerate(read_args):
        assert args[i].Name == read_args[i].Name
        assert args[i].ArrayDimensions == read_args[i].ArrayDimensions
        assert args[i].Description == read_args[i].Description
        assert args[i].DataType == read_args[i].DataType
    await opc.opc.delete_nodes([node, node2])
Ejemplo n.º 2
0
def _vtype_to_argument(vtype):
    if isinstance(vtype, ua.Argument):
        return vtype
    arg = ua.Argument()
    if isinstance(vtype, ua.VariantType):
        arg.DataType = ua.NodeId(vtype.value)
    else:
        arg.DataType = ua.NodeId(vtype)
    return arg
Ejemplo n.º 3
0
async def test_base_data_type(opc):
    nint32 = opc.opc.get_node(ua.ObjectIds.Int32)
    dtype = await nint32.add_data_type(0, "MyCustomDataType")
    dtype2 = await dtype.add_data_type(0, "MyCustomDataType2")
    assert nint32 == await ua_utils.get_base_data_type(dtype)
    assert nint32 == await ua_utils.get_base_data_type(dtype2)

    ext = await opc.opc.nodes.objects.add_variable(0, "MyExtensionObject", ua.Argument())
    d = await ext.read_data_type()
    d = opc.opc.get_node(d)
    assert opc.opc.get_node(ua.ObjectIds.Structure) == await ua_utils.get_base_data_type(d)
    assert ua.VariantType.ExtensionObject == await ua_utils.data_type_to_variant_type(d)
Ejemplo n.º 4
0
async def test_xml_ext_obj(opc, tmpdir):
    arg = ua.Argument()
    arg.DataType = ua.NodeId(ua.ObjectIds.Float)
    arg.Description = ua.LocalizedText("Nice description")
    arg.ArrayDimensions = [1, 2, 3]
    arg.Name = "MyArg"
    node = await opc.opc.nodes.objects.add_variable(2, "xmlexportobj2", arg)
    node2 = await _test_xml_var_type(opc, tmpdir, node, "ext_obj", test_equality=False)
    arg2 = await node2.read_value()
    assert arg.Name == arg2.Name
    assert arg.ArrayDimensions == arg2.ArrayDimensions
    assert arg.Description == arg2.Description
    assert arg.DataType == arg2.DataType
Ejemplo n.º 5
0
def _vtype_to_argument(vtype):
    if isinstance(vtype, ua.Argument):
        return vtype
    arg = ua.Argument()
    if hasattr(vtype, "data_type"):
        arg.DataType = vtype.data_type
    elif isinstance(vtype, ua.VariantType):
        arg.DataType = ua.NodeId(vtype.value)
    elif hasattr(ua.VariantType, vtype.__name__):
        arg.DataType = ua.NodeId(ua.VariantType[vtype.__name__].value)
    else:
        arg.DataType = ua.NodeId(vtype)
    return arg
Ejemplo n.º 6
0
def _vtype_to_argument(vtype):
    if isinstance(vtype, ua.Argument):
        return vtype
    arg = ua.Argument()
    if hasattr(vtype, "data_type"):
        arg.DataType = vtype.data_type
    elif inspect.isclass(vtype) and issubclass(vtype, Enum):
        arg.DataType = ua.enums_datatypes[vtype]
    elif isinstance(vtype, ua.VariantType):
        arg.DataType = ua.NodeId(vtype.value)
    elif isinstance(vtype, ua.NodeId):
        arg.DataType = vtype
    elif hasattr(
            vtype,
            "nodeid"):  # NodeId case but we cannot import Node object here
        arg.DataType = vtype.nodeid
    elif hasattr(vtype, "__name__") and hasattr(ua.VariantType,
                                                vtype.__name__):
        arg.DataType = ua.NodeId(ua.VariantType[vtype.__name__].value)
    else:
        arg.DataType = ua.NodeId(vtype)
    return arg
def create_standard_address_space_Part17(server):

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23455, 0)
    node.BrowseName = QualifiedName('AliasNameType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(58, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameType")
    attrs.IsAbstract = False
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23455, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(58, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23456, 0)
    node.BrowseName = QualifiedName('AliasNameCategoryType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(61, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameCategoryType")
    attrs.IsAbstract = False
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23457, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23458, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(61, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23457, 0)
    node.BrowseName = QualifiedName('<Alias>', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    node.TypeDefinition = NumericNodeId(23455, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("<Alias>")
    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(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23455, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(11508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23458, 0)
    node.BrowseName = QualifiedName('<SubAliasNameCategories>', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("<SubAliasNameCategories>")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(11508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23459, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23458, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23460, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23461, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23458, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23460, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23459, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23460, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23460, 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(23460, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23461, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23459, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23461, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23461, 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(23461, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23462, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23463, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23464, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23463, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23462, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23463, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23463, 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(23463, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23464, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23462, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23464, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23464, 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(23464, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23468, 0)
    node.BrowseName = QualifiedName('AliasNameDataType', 0)
    node.NodeClass = NodeClass.DataType
    node.ParentNodeId = NumericNodeId(22, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.DataTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameDataType")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23468, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(22, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23469, 0)
    node.BrowseName = QualifiedName('AliasFor', 0)
    node.NodeClass = NodeClass.ReferenceType
    node.ParentNodeId = NumericNodeId(32, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ReferenceTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasFor")
    attrs.InverseName = LocalizedText("HasAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23469, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(32, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23470, 0)
    node.BrowseName = QualifiedName('Aliases', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(85, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Aliases")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(85, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23476, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23477, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23478, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23477, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23476, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23477, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23477, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23478, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23476, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23478, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23478, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23479, 0)
    node.BrowseName = QualifiedName('Tags', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Tags")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23485, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23479, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23486, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23487, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23479, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23486, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23485, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23486, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23486, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23487, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23485, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23487, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23487, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23488, 0)
    node.BrowseName = QualifiedName('Topics', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Topics")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23494, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23488, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23495, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23496, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23488, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23495, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23494, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23495, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23495, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23496, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23494, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23496, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23496, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23499, 0)
    node.BrowseName = QualifiedName('Default Binary', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default Binary")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(39, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23502, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23505, 0)
    node.BrowseName = QualifiedName('Default XML', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default XML")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(39, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)

    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23511, 0)
    node.BrowseName = QualifiedName('Default JSON', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default JSON")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23511, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23511, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)
Ejemplo n.º 8
0
async def main():
    # optional: setup logging
    logging.basicConfig(level=logging.WARN)
    # logger = logging.getLogger("asyncua.address_space")
    # logger.setLevel(logging.DEBUG)
    # logger = logging.getLogger("asyncua.internal_server")
    # logger.setLevel(logging.DEBUG)
    # logger = logging.getLogger("asyncua.binary_server_asyncio")
    # logger.setLevel(logging.DEBUG)
    # logger = logging.getLogger("asyncua.uaprocessor")
    # logger.setLevel(logging.DEBUG)
    # logger = logging.getLogger("asyncua.subscription_service")
    # logger.setLevel(logging.DEBUG)

    # now setup our server
    server = Server()
    await server.init()
    # server.set_endpoint("opc.tcp://localhost:4840/freeopcua/server/")
    server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")
    server.set_server_name("FreeOpcUa Example Server")

    # setup our own namespace
    uri = "http://examples.freeopcua.github.io"
    idx = await server.register_namespace(uri)

    # get Objects node, this is where we should put our custom stuff
    objects = server.get_objects_node()

    # populating our address space
    await objects.add_folder(idx, "myEmptyFolder")
    myobj = await objects.add_object(idx, "MyObject")
    myvar = await myobj.add_variable(idx, "MyVariable", 6.7)
    await myvar.set_writable()  # Set MyVariable to be writable by clients
    myarrayvar = await myobj.add_variable(idx, "myarrayvar", [6.7, 7.9])
    await myobj.add_variable(idx, "myStronglytTypedVariable",
                             ua.Variant([], ua.VariantType.UInt32))
    await myobj.add_property(idx, "myproperty", "I am a property")
    await myobj.add_method(idx, "mymethod", func, [ua.VariantType.Int64],
                           [ua.VariantType.Boolean])

    inargx = ua.Argument()
    inargx.Name = "x"
    inargx.DataType = ua.NodeId(ua.ObjectIds.Int64)
    inargx.ValueRank = -1
    inargx.ArrayDimensions = []
    inargx.Description = ua.LocalizedText("First number x")
    inargy = ua.Argument()
    inargy.Name = "y"
    inargy.DataType = ua.NodeId(ua.ObjectIds.Int64)
    inargy.ValueRank = -1
    inargy.ArrayDimensions = []
    inargy.Description = ua.LocalizedText("Second number y")
    outarg = ua.Argument()
    outarg.Name = "Result"
    outarg.DataType = ua.NodeId(ua.ObjectIds.Int64)
    outarg.ValueRank = -1
    outarg.ArrayDimensions = []
    outarg.Description = ua.LocalizedText("Multiplication result")

    await myobj.add_method(idx, "multiply", multiply, [inargx, inargy],
                           [outarg])
    await myobj.add_method(idx, "multiply_async", multiply_async,
                           [inargx, inargy], [])
    await myobj.add_method(idx, "func_async", func_async,
                           [ua.VariantType.Int64], [])

    async with server:
        while True:
            await asyncio.sleep(1)
Ejemplo n.º 9
0
    idx = server.register_namespace(uri)

    # get Objects node, this is where we should put our custom stuff
    objects = server.get_objects_node()

    # populating our address space
    myfolder = objects.add_folder(idx, "myEmptyFolder")
    myobj = objects.add_object(idx, "MyObject")
    myvar = myobj.add_variable(idx, "MyVariable", 6.7)
    myvar.set_writable()    # Set MyVariable to be writable by clients
    myarrayvar = myobj.add_variable(idx, "myarrayvar", [6.7, 7.9])
    myarrayvar = myobj.add_variable(idx, "myStronglytTypedVariable", ua.Variant([], ua.VariantType.UInt32))
    myprop = myobj.add_property(idx, "myproperty", "I am a property")
    mymethod = myobj.add_method(idx, "mymethod", func, [ua.VariantType.Int64], [ua.VariantType.Boolean])

    inargx = ua.Argument()
    inargx.Name = "x"
    inargx.DataType = ua.NodeId(ua.ObjectIds.Int64)
    inargx.ValueRank = -1
    inargx.ArrayDimensions = []
    inargx.Description = ua.LocalizedText("First number x")
    inargy = ua.Argument()
    inargy.Name = "y"
    inargy.DataType = ua.NodeId(ua.ObjectIds.Int64)
    inargy.ValueRank = -1
    inargy.ArrayDimensions = []
    inargy.Description = ua.LocalizedText("Second number y")
    outarg = ua.Argument()
    outarg.Name = "Result"
    outarg.DataType = ua.NodeId(ua.ObjectIds.Int64)
    outarg.ValueRank = -1
Ejemplo n.º 10
0
async def main():
    @uamethod
    async def callback(parent, in_extobj):
        out_extobj = ua.uaprotocol_auto.AxisInformation(
        )  # get new instanace of AxisInformation
        out_extobj.EngineeringUnits = in_extobj.EngineeringUnits
        out_extobj.EURange.Low = in_extobj.EURange.Low
        out_extobj.EURange.High = in_extobj.EURange.High
        out_extobj.Title = in_extobj.Title
        out_extobj.AxisScaleType = in_extobj.AxisScaleType
        out_extobj.AxisSteps = in_extobj.AxisSteps

        await axis_info.set_value(out_extobj)  #write values to variable

        ret = (ua.Variant(out_extobj, ua.VariantType.ExtensionObject),
               ua.Variant("test", ua.VariantType.String))

        return ret

    server = Server()
    await server.init()
    server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")
    server.set_security_policy([ua.SecurityPolicyType.NoSecurity])

    obj = server.get_objects_node()
    idx = await server.register_namespace("http://examples.freeopcua.github.io"
                                          )

    await server.load_data_type_definitions()

    inarg_extobj = ua.Argument()
    inarg_extobj.Name = "In"
    inarg_extobj.DataType = ua.NodeId(12079, 0)
    inarg_extobj.ValueRank = -1
    inarg_extobj.ArrayDimensions = []
    inarg_extobj.Description = ua.LocalizedText("Wanted AxisInformation")

    outarg_extobj = ua.Argument()
    outarg_extobj.Name = "Out"
    outarg_extobj.DataType = ua.NodeId(12079, 0)
    outarg_extobj.ValueRank = -1
    outarg_extobj.ArrayDimensions = []
    outarg_extobj.Description = ua.LocalizedText("Actual AxisInformation")

    status = ua.Argument()
    status.Name = "Status"
    status.DataType = ua.NodeId(12, 0)
    status.ValueRank = -1
    status.ArrayDimensions = []
    status.Description = ua.LocalizedText("MSG")

    method_parent = await obj.add_object(idx, "Methods")
    method_node = await method_parent.add_method(idx, "SetAxisInformation",
                                                 callback, [inarg_extobj],
                                                 [outarg_extobj, status])

    #add a variable of type AxisInformation
    axis_info = await obj.add_variable(
        idx,
        "AxisInformation",
        ua.uaprotocol_auto.AxisInformation(),
        varianttype=ua.VariantType.ExtensionObject)

    async with server:
        while 1:
            await asyncio.sleep(0)