Completed
Pull Request — master (#509)
by
unknown
07:05
created

Node.delete_reference()   B

Complexity

Conditions 5

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5.1158

Importance

Changes 0
Metric Value
cc 5
c 0
b 0
f 0
dl 0
loc 22
ccs 10
cts 12
cp 0.8333
crap 5.1158
rs 8.3411
1
"""
2
High level node object, to access node attribute
3
and browse address space
4
"""
5
6 1
from opcua import ua
7 1
from opcua.common import events
8 1
import opcua.common
9
10 1
def _check_results(results, reqlen = 1):
11
    assert len(results) == reqlen, results
12
    for r in results:
13
        r.check()
14
15
def _to_nodeid(nodeid):
16
    if isinstance(nodeid, int):
17
        return ua.TwoByteNodeId(nodeid)
18
    elif isinstance(nodeid, Node):
19
        return nodeid.nodeid
20 1
    elif isinstance(nodeid, ua.NodeId):
21 1
        return nodeid
22 1
    elif type(nodeid) in (str, bytes):
23 1
        return ua.NodeId.from_string(nodeid)
24 1
    else:
25 1
        raise ua.UaError("Could not resolve '{0}' to a type id".format(nodeid))
26 1
27 1
class Node(object):
28 1
29 1
    """
30 1
    High level node object, to access node attribute,
31
    browse and populate address space.
32
    Node objects are usefull as-is but they do not expose the entire
33
    OPC-UA protocol. Feel free to look at the code of this class and call
34 1
    directly UA services methods to optimize your code
35 1
    """
36 1
37 1
    def __init__(self, server, nodeid):
38
        self.server = server
39 1
        self.nodeid = None
40
        if isinstance(nodeid, Node):
41
            self.nodeid = nodeid.nodeid
42 1
        elif isinstance(nodeid, ua.NodeId):
43 1
            self.nodeid = nodeid
44 1
        elif type(nodeid) in (str, bytes):
45
            self.nodeid = ua.NodeId.from_string(nodeid)
46 1
        elif isinstance(nodeid, int):
47 1
            self.nodeid = ua.NodeId(nodeid, 0)
48
        else:
49 1
            raise ua.UaError("argument to node must be a NodeId object or a string defining a nodeid found {0} of type {1}".format(nodeid, type(nodeid)))
50
51
    def __eq__(self, other):
52
        if isinstance(other, Node) and self.nodeid == other.nodeid:
53
            return True
54 1
        return False
55 1
56
    def __ne__(self, other):
57 1
        return not self.__eq__(other)
58
59
    def __str__(self):
60
        return "Node({0})".format(self.nodeid)
61 1
    __repr__ = __str__
62 1
63
    def __hash__(self):
64 1
        return self.nodeid.__hash__()
65
66
    def get_browse_name(self):
67
        """
68 1
        Get browse name of a node. A browse name is a QualifiedName object
69 1
        composed of a string(name) and a namespace index.
70
        """
71 1
        result = self.get_attribute(ua.AttributeIds.BrowseName)
72
        return result.Value.Value
73
74
    def get_display_name(self):
75
        """
76
        get description attribute of node
77 1
        """
78 1
        result = self.get_attribute(ua.AttributeIds.DisplayName)
79
        return result.Value.Value
80 1
81
    def get_data_type(self):
82
        """
83
        get data type of node as NodeId
84
        """
85
        result = self.get_attribute(ua.AttributeIds.DataType)
86
        return result.Value.Value
87 1
88
    def get_data_type_as_variant_type(self):
89
        """
90
        get data type of node as VariantType
91
        This only works if node is a variable, otherwise type
92
        may not be convertible to VariantType
93
        """
94 1
        result = self.get_attribute(ua.AttributeIds.DataType)
95
        return opcua.common.ua_utils.data_type_to_variant_type(Node(self.server, result.Value.Value))
96
97
    def get_access_level(self):
98 1
        """
99 1
        Get the access level attribute of the node as a set of AccessLevel enum values.
100
        """
101 1
        result = self.get_attribute(ua.AttributeIds.AccessLevel)
102
        return ua.AccessLevel.parse_bitfield(result.Value.Value)
103
104
    def get_user_access_level(self):
105
        """
106
        Get the user access level attribute of the node as a set of AccessLevel enum values.
107 1
        """
108 1
        result = self.get_attribute(ua.AttributeIds.UserAccessLevel)
109
        return ua.AccessLevel.parse_bitfield(result.Value.Value)
110 1
111
    def get_event_notifier(self):
112
        """
113
        Get the event notifier attribute of the node as a set of EventNotifier enum values.
114 1
        """
115 1
        result = self.get_attribute(ua.AttributeIds.EventNotifier)
116
        return ua.EventNotifier.parse_bitfield(result.Value.Value)
117 1
118
    def set_event_notifier(self, values):
119
        """
120
        Set the event notifier attribute.
121 1
122 1
        :param values: an iterable of EventNotifier enum values.
123
        """
124 1
        event_notifier_bitfield = ua.EventNotifier.to_bitfield(values)
125
        self.set_attribute(ua.AttributeIds.EventNotifier, ua.DataValue(ua.Variant(event_notifier_bitfield, ua.VariantType.Byte)))
126
127
    def get_node_class(self):
128
        """
129 1
        get node class attribute of node
130 1
        """
131
        result = self.get_attribute(ua.AttributeIds.NodeClass)
132 1
        return result.Value.Value
133
134
    def get_description(self):
135
        """
136
        get description attribute class of node
137
        """
138 1
        result = self.get_attribute(ua.AttributeIds.Description)
139
        return result.Value.Value
140 1
141
    def get_value(self):
142
        """
143
        Get value of a node as a python type. Only variables ( and properties) have values.
144
        An exception will be generated for other node types.
145 1
        """
146 1
        result = self.get_data_value()
147
        return result.Value.Value
148 1
149
    def get_data_value(self):
150
        """
151
        Get value of a node as a DataValue object. Only variables (and properties) have values.
152 1
        An exception will be generated for other node types.
153 1
        DataValue contain a variable value as a variant as well as server and source timestamps
154
        """
155 1
        return self.get_attribute(ua.AttributeIds.Value)
156
157
    def set_array_dimensions(self, value):
158
        """
159 1
        Set attribute ArrayDimensions of node
160 1
        make sure it has the correct data type
161
        """
162 1
        v = ua.Variant(value, ua.VariantType.UInt32)
163
        self.set_attribute(ua.AttributeIds.ArrayDimensions, ua.DataValue(v))
164
165
    def get_array_dimensions(self):
166 1
        """
167 1
        Read and return ArrayDimensions attribute of node
168
        """
169 1
        res = self.get_attribute(ua.AttributeIds.ArrayDimensions)
170
        return res.Value.Value
171
172
    def set_value_rank(self, value):
173
        """
174
        Set attribute ArrayDimensions of node
175
        """
176
        v = ua.Variant(value, ua.VariantType.Int32)
177
        self.set_attribute(ua.AttributeIds.ValueRank, ua.DataValue(v))
178
179 1
    def get_value_rank(self):
180 1
        """
181 1
        Read and return ArrayDimensions attribute of node
182 1
        """
183 1
        res = self.get_attribute(ua.AttributeIds.ValueRank)
184
        return res.Value.Value
185 1
186 1
    def set_value(self, value, varianttype=None):
187
        """
188 1
        Set value of a node. Only variables(properties) have values.
189
        An exception will be generated for other node types.
190 1
        value argument is either:
191
        * a python built-in type, converted to opc-ua
192
        optionnaly using the variantype argument.
193
        * a ua.Variant, varianttype is then ignored
194
        * a ua.DataValue, you then have full control over data send to server
195 1
        """
196 1
        datavalue = None
197 1
        if isinstance(value, ua.DataValue):
198
            datavalue = value
199 1
        elif isinstance(value, ua.Variant):
200 1
            datavalue = ua.DataValue(value)
201
        else:
202 1
            datavalue = ua.DataValue(ua.Variant(value, varianttype))
203 1
        self.set_attribute(ua.AttributeIds.Value, datavalue)
204 1
205 1
    set_data_value = set_value
206
207 1
    def set_writable(self, writable=True):
208 1
        """
209 1
        Set node as writable by clients.
210 1
        A node is always writable on server side.
211
        """
212 1
        if writable:
213
            self.set_attr_bit(ua.AttributeIds.AccessLevel, ua.AccessLevel.CurrentWrite)
214
            self.set_attr_bit(ua.AttributeIds.UserAccessLevel, ua.AccessLevel.CurrentWrite)
215
        else:
216
            self.unset_attr_bit(ua.AttributeIds.AccessLevel, ua.AccessLevel.CurrentWrite)
217
            self.unset_attr_bit(ua.AttributeIds.UserAccessLevel, ua.AccessLevel.CurrentWrite)
218
219 1
    def set_attr_bit(self, attr, bit):
220
        val = self.get_attribute(attr)
221
        val.Value.Value = ua.ua_binary.set_bit(val.Value.Value, bit)
222
        self.set_attribute(attr, val)
223
224
    def unset_attr_bit(self, attr, bit):
225 1
        val = self.get_attribute(attr)
226 1
        val.Value.Value = ua.ua_binary.unset_bit(val.Value.Value, bit)
227 1
        self.set_attribute(attr, val)
228 1
229 1
    def set_read_only(self):
230 1
        """
231 1
        Set a node as read-only for clients.
232 1
        A node is always writable on server side.
233
        """
234 1
        return self.set_writable(False)
235
236
    def set_attribute(self, attributeid, datavalue):
237
        """
238
        Set an attribute of a node
239 1
        attributeid is a member of ua.AttributeIds
240 1
        datavalue is a ua.DataValue object
241 1
        """
242 1
        attr = ua.WriteValue()
243 1
        attr.NodeId = self.nodeid
244 1
        attr.AttributeId = attributeid
245 1
        attr.Value = datavalue
246 1
        params = ua.WriteParameters()
247
        params.NodesToWrite = [attr]
248 1
        result = self.server.write(params)
249
        result[0].check()
250
251
    def get_attribute(self, attr):
252
        """
253 1
        Read one attribute of a node
254 1
        result code from server is checked and an exception is raised in case of error
255 1
        """
256 1
        rv = ua.ReadValueId()
257 1
        rv.NodeId = self.nodeid
258 1
        rv.AttributeId = attr
259
        params = ua.ReadParameters()
260 1
        params.NodesToRead.append(rv)
261 1
        result = self.server.read(params)
262
        result[0].StatusCode.check()
263 1
        return result[0]
264
265
    def get_attributes(self, attrs):
266
        """
267
        Read several attributes of a node
268
        list of DataValue is returned
269
        """
270
        params = ua.ReadParameters()
271
        for attr in attrs:
272
            rv = ua.ReadValueId()
273
            rv.NodeId = self.nodeid
274
            rv.AttributeId = attr
275
            params.NodesToRead.append(rv)
276
277
        results = self.server.read(params)
278
        return results
279
280
    def get_children(self, refs=ua.ObjectIds.HierarchicalReferences, nodeclassmask=ua.NodeClass.Unspecified):
281
        """
282
        Get all children of a node. By default hierarchical references and all node classes are returned.
283
        Other reference types may be given:
284
        References = 31
285 1
        NonHierarchicalReferences = 32
286
        HierarchicalReferences = 33
287 1
        HasChild = 34
288
        Organizes = 35
289
        HasEventSource = 36
290
        HasModellingRule = 37
291
        HasEncoding = 38
292 1
        HasDescription = 39
293
        HasTypeDefinition = 40
294 1
        GeneratesEvent = 41
295
        Aggregates = 44
296
        HasSubtype = 45
297
        HasProperty = 46
298
        HasComponent = 47
299 1
        HasNotifier = 48
300
        HasOrderedComponent = 49
301 1
        """
302
        return self.get_referenced_nodes(refs, ua.BrowseDirection.Forward, nodeclassmask)
303
304
    def get_properties(self):
305
        """
306 1
        return properties of node.
307
        properties are child nodes with a reference of type HasProperty and a NodeClass of Variable
308 1
        """
309 1
        return self.get_children(refs=ua.ObjectIds.HasProperty, nodeclassmask=ua.NodeClass.Variable)
310
311 1
    def get_variables(self):
312
        """
313
        return variables of node.
314 1
        properties are child nodes with a reference of type HasComponent and a NodeClass of Variable
315
        """
316
        return self.get_children(refs=ua.ObjectIds.HasComponent, nodeclassmask=ua.NodeClass.Variable)
317 1
318
    def get_methods(self):
319
        """
320
        return methods of node.
321
        properties are child nodes with a reference of type HasComponent and a NodeClass of Method
322
        """
323
        return self.get_children(refs=ua.ObjectIds.HasComponent, nodeclassmask=ua.NodeClass.Method)
324
325
    def get_children_descriptions(self, refs=ua.ObjectIds.HierarchicalReferences, nodeclassmask=ua.NodeClass.Unspecified, includesubtypes=True):
326 1
        return self.get_references(refs, ua.BrowseDirection.Forward, nodeclassmask, includesubtypes)
327 1
328 1
    def get_encoding_refs(self):
329 1
        return self.get_referenced_nodes(ua.ObjectIds.HasEncoding, ua.BrowseDirection.Forward)
330 1
331 1
    def get_description_refs(self):
332
        return self.get_referenced_nodes(ua.ObjectIds.HasDescription, ua.BrowseDirection.Forward)
333 1
334 1
    def get_references(self, refs=ua.ObjectIds.References, direction=ua.BrowseDirection.Both, nodeclassmask=ua.NodeClass.Unspecified, includesubtypes=True):
335 1
        """
336 1
        returns references of the node based on specific filter defined with:
337 1
338 1
        refs = ObjectId of the Reference
339
        direction = Browse direction for references
340 1
        nodeclassmask = filter nodes based on specific class
341 1
        includesubtypes = If true subtypes of the reference (ref) are also included
342
        """
343 1
        desc = ua.BrowseDescription()
344 1
        desc.BrowseDirection = direction
345 1
        desc.ReferenceTypeId = _to_nodeid(refs)
346
        desc.IncludeSubtypes = includesubtypes
347
        desc.NodeClassMask = nodeclassmask
348
        desc.ResultMask = ua.BrowseResultMask.All
349
350
        desc.NodeId = self.nodeid
351 1
        params = ua.BrowseParameters()
352
        params.View.Timestamp = ua.get_win_epoch()
353 1
        params.NodesToBrowse.append(desc)
354
        params.RequestedMaxReferencesPerNode = 0
355
        results = self.server.browse(params)
356
357
        references = self._browse_next(results)
358
        return references
359 1
360 1
    def _browse_next(self, results):
361 1
        references = results[0].References
362 1
        while results[0].ContinuationPoint:
363 1
            params = ua.BrowseNextParameters()
364 1
            params.ContinuationPoints = [results[0].ContinuationPoint]
365
            params.ReleaseContinuationPoints = False
366 1
            results = self.server.browse_next(params)
367
            references.extend(results[0].References)
368
        return references
369
370 1
    def get_referenced_nodes(self, refs=ua.ObjectIds.References, direction=ua.BrowseDirection.Both, nodeclassmask=ua.NodeClass.Unspecified, includesubtypes=True):
371 1
        """
372 1
        returns referenced nodes based on specific filter
373 1
        Paramters are the same as for get_references
374
375 1
        """
376
        references = self.get_references(refs, direction, nodeclassmask, includesubtypes)
377
        nodes = []
378
        for desc in references:
379
            node = Node(self.server, desc.NodeId)
380
            nodes.append(node)
381
        return nodes
382
383
    def get_type_definition(self):
384 1
        """
385 1
        returns type definition of the node.
386 1
        """
387 1
        references = self.get_references(refs=ua.ObjectIds.HasTypeDefinition, direction=ua.BrowseDirection.Forward)
388 1
        if len(references) == 0:
389 1
            return None
390
        return references[0].NodeId
391 1
392
    def get_path(self, max_length=20, as_string=False):
393
        """
394
        Attempt to find path of node from root node and return it as a list of Nodes.
395
        There might several possible paths to a node, this function will return one
396
        Some nodes may be missing references, so this method may
397
        return an empty list
398
        Since address space may have circular references, a max length is specified
399
400 1
        """
401 1
        path = self._get_path(max_length)
402 1
        path = [Node(self.server, ref.NodeId) for ref in path]
403 1
        path.append(self)
404 1
        if as_string:
405 1
            path = [el.get_browse_name().to_string() for el in path]
406 1
        return path
407 1
408 1
    def _get_path(self, max_length=20):
409
        """
410 1
        Attempt to find path of node from root node and return it as a list of Nodes.
411
        There might several possible paths to a node, this function will return one
412 1
        Some nodes may be missing references, so this method may
413
        return an empty list
414
        Since address space may have circular references, a max length is specified
415
416
        """
417
        path = []
418
        node = self
419 1
        while True:
420 1
            refs = node.get_references(refs=ua.ObjectIds.HierarchicalReferences, direction=ua.BrowseDirection.Inverse)
421 1
            if len(refs) > 0:
422
                path.insert(0, refs[0])
423
                node = Node(self.server, refs[0].NodeId)
424
                if len(path) >= (max_length -1):
425 1
                    return path
426
            else:
427
                return path
428
429
    def get_parent(self):
430
        """
431
        returns parent of the node.
432
        A Node may have several parents, the first found is returned.
433
        This method uses reverse references, a node might be missing such a link,
434 1
        thus we will not find its parent.
435 1
        """
436 1
        refs = self.get_references(refs=ua.ObjectIds.HierarchicalReferences, direction=ua.BrowseDirection.Inverse)
437 1
        if len(refs) > 0:
438 1
            return Node(self.server, refs[0].NodeId)
439 1
        else:
440 1
            return None
441 1
442 1
    def get_child(self, path):
443
        """
444 1
        get a child specified by its path from this node.
445
        A path might be:
446 1
        * a string representing a qualified name.
447 1
        * a qualified name
448 1
        * a list of string
449 1
        * a list of qualified names
450 1
        """
451 1
        if type(path) not in (list, tuple):
452 1
            path = [path]
453 1
        rpath = self._make_relative_path(path)
454
        bpath = ua.BrowsePath()
455
        bpath.StartingNode = self.nodeid
456 1
        bpath.RelativePath = rpath
457 1
        result = self.server.translate_browsepaths_to_nodeids([bpath])
458 1
        result = result[0]
459
        result.StatusCode.check()
460 1
        # FIXME: seems this method may return several nodes
461
        return Node(self.server, result.Targets[0].TargetId)
462
463
    def _make_relative_path(self, path):
464
        rpath = ua.RelativePath()
465
        for item in path:
466
            el = ua.RelativePathElement()
467 1
            el.ReferenceTypeId = ua.TwoByteNodeId(ua.ObjectIds.HierarchicalReferences)
468 1
            el.IsInverse = False
469 1
            el.IncludeSubtypes = True
470 1
            if isinstance(item, ua.QualifiedName):
471
                el.TargetName = item
472 1
            else:
473 1
                el.TargetName = ua.QualifiedName.from_string(item)
474 1
            rpath.Elements.append(el)
475
        return rpath
476 1
477 1
    def read_raw_history(self, starttime=None, endtime=None, numvalues=0):
478 1
        """
479 1
        Read raw history of a node
480 1
        result code from server is checked and an exception is raised in case of error
481
        If numvalues is > 0 and number of events in period is > numvalues
482 1
        then result will be truncated
483
        """
484
        details = ua.ReadRawModifiedDetails()
485
        details.IsReadModified = False
486
        if starttime:
487 1
            details.StartTime = starttime
488 1
        else:
489 1
            details.StartTime = ua.get_win_epoch()
490
        if endtime:
491 1
            details.EndTime = endtime
492 1
        else:
493 1
            details.EndTime = ua.get_win_epoch()
494 1
        details.NumValuesPerNode = numvalues
495 1
        details.ReturnBounds = True
496 1
        result = self.history_read(details)
497 1
        return result.HistoryData.DataValues
498
499 1 View Code Duplication
    def history_read(self, details):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
500
        """
501
        Read raw history of a node, low-level function
502
        result code from server is checked and an exception is raised in case of error
503
        """
504
        valueid = ua.HistoryReadValueId()
505
        valueid.NodeId = self.nodeid
506
        valueid.IndexRange = ''
507 1
508 1
        params = ua.HistoryReadParameters()
509 1
        params.HistoryReadDetails = details
510
        params.TimestampsToReturn = ua.TimestampsToReturn.Both
511 1
        params.ReleaseContinuationPoints = False
512 1
        params.NodesToRead.append(valueid)
513 1
        result = self.server.history_read(params)[0]
514
        return result
515 1
516 1
    def read_event_history(self, starttime=None, endtime=None, numvalues=0, evtypes=ua.ObjectIds.BaseEventType):
517
        """
518 1
        Read event history of a source node
519 1
        result code from server is checked and an exception is raised in case of error
520
        If numvalues is > 0 and number of events in period is > numvalues
521 1
        then result will be truncated
522
        """
523 1
524 1
        details = ua.ReadEventDetails()
525
        if starttime:
526 1
            details.StartTime = starttime
527 1
        else:
528 1
            details.StartTime = ua.get_win_epoch()
529 1
        if endtime:
530 1
            details.EndTime = endtime
531
        else:
532 1
            details.EndTime = ua.get_win_epoch()
533
        details.NumValuesPerNode = numvalues
534
535
        if not isinstance(evtypes, (list, tuple)):
536
            evtypes = [evtypes]
537 1
538 1
        evtypes = [Node(self.server, evtype) for evtype in evtypes]
539 1
540
        evfilter = events.get_filter_from_event_type(evtypes)
541 1
        details.Filter = evfilter
542 1
543 1
        result = self.history_read_events(details)
544 1
        event_res = []
545 1
        for res in result.HistoryData.Events:
546 1
            event_res.append(events.Event.from_event_fields(evfilter.SelectClauses, res.EventFields))
547 1
        return event_res
548
549 1 View Code Duplication
    def history_read_events(self, details):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
550
        """
551
        Read event history of a node, low-level function
552
        result code from server is checked and an exception is raised in case of error
553
        """
554
        valueid = ua.HistoryReadValueId()
555
        valueid.NodeId = self.nodeid
556
        valueid.IndexRange = ''
557
558
        params = ua.HistoryReadParameters()
559
        params.HistoryReadDetails = details
560
        params.TimestampsToReturn = ua.TimestampsToReturn.Both
561 1
        params.ReleaseContinuationPoints = False
562 1
        params.NodesToRead.append(valueid)
563
        result = self.server.history_read(params)[0]
564 1
        return result
565 1
566
    def delete(self, delete_references=True, recursive=False):
567 1
        """
568 1
        Delete node from address space
569
        """
570 1
        results = opcua.common.manage_nodes.delete_nodes(self.server, [self], recursive, delete_references)
571 1
        _check_results(results)
572
573 1
    def delete_reference(self, target, reftype, forward=True, bidirectional=True):
574
        """
575
        Delete given node's references from address space
576 1
        """
577 1
        known_refs = self.get_references(reftype, includesubtypes=False)
578
        targetid = _to_nodeid(target)
579 1
580 1
        for r in known_refs:
581
            if r.NodeId == targetid and r.IsForward == forward:
582 1
                rdesc = r
583 1
                break
584
        else:
585 1
            raise ua.UaStatusCodeError(ua.StatusCodes.BadNotFound)
586
587
        ditem = ua.DeleteReferencesItem()
588 1
        ditem.SourceNodeId = self.nodeid
589 1
        ditem.TargetNodeId = rdesc.NodeId
590
        ditem.ReferenceTypeId = rdesc.ReferenceTypeId
591
        ditem.IsForward = rdesc.IsForward
592
        ditem.DeleteBidirectional = bidirectional
593
594
        self.server.delete_references([ditem])[0].check()
595
596
    def add_reference(self, target, reftype, forward=True, bidirectional=True):
597
        """
598
        Add reference to node
599
        """
600
601
        aitem = ua.AddReferencesItem()
602
        aitem.SourceNodeId = self.nodeid
603
        aitem.TargetNodeId = _to_nodeid(target)
604
        aitem.ReferenceTypeId = _to_nodeid(reftype)
605
        aitem.IsForward = forward
606
607
        params = [aitem]
608
609
        if bidirectional:
610
            aitem2 = ua.AddReferencesItem()
611
            aitem2.SourceNodeId = aitem.TargetNodeId
612
            aitem2.TargetNodeId = aitem.SourceNodeId
613
            aitem2.ReferenceTypeId = aitem.ReferenceTypeId
614
            aitem2.IsForward = not forward
615
            params.append(aitem2)
616
617
        results =  self.server.add_references(params)
618
        _check_results(results, len(params))
619
620
    def add_folder(self, nodeid, bname):
621
        return  opcua.common.manage_nodes.create_folder(self, nodeid, bname)
622
623
    def add_object(self, nodeid, bname, objecttype=None):
624
        return opcua.common.manage_nodes.create_object(self, nodeid, bname, objecttype)
625
626
    def add_variable(self, nodeid, bname, val, varianttype=None, datatype=None):
627
        return opcua.common.manage_nodes.create_variable(self, nodeid, bname, val, varianttype, datatype)
628
629
    def add_object_type(self, nodeid, bname):
630
        return opcua.common.manage_nodes.create_object_type(self, nodeid, bname)
631
632
    def add_variable_type(self, nodeid, bname, datatype):
633
        return opcua.common.manage_nodes.create_variable_type(self, nodeid, bname, datatype)
634
635
    def add_data_type(self, nodeid, bname, description=None):
636
        return opcua.common.manage_nodes.create_data_type(self, nodeid, bname, description=None)
637
638
    def add_property(self, nodeid, bname, val, varianttype=None, datatype=None):
639
        return opcua.common.manage_nodes.create_property(self, nodeid, bname, val, varianttype, datatype)
640
641
    def add_method(self, *args):
642
        return opcua.common.manage_nodes.create_method(self, *args)
643
644
    def add_reference_type(self, nodeid, bname, symmetric=True, inversename=None):
645
        return opcua.common.manage_nodes.create_reference_type(self, nodeid, bname, symmetric, inversename)
646
647
    def call_method(self, methodid, *args):
648
        return opcua.common.methods.call_method(self, methodid, *args)
649