Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_xml_ext_obj(self):
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 = self.opc.nodes.objects.add_variable(2, "xmlexportobj2", arg)
node2 = self._test_xml_var_type(node, "ext_obj", test_equality=False)
arg2 = node2.get_value()
self.assertEqual(arg.Name, arg2.Name)
self.assertEqual(arg.ArrayDimensions, arg2.ArrayDimensions)
self.assertEqual(arg.Description, arg2.Description)
self.assertEqual(arg.DataType, arg2.DataType)
ref.IsForward = False
ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
ref.SourceNodeId = ua.NodeId.from_string("i=7")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=28")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=8")
node.BrowseName = ua.QualifiedName.from_string("Int64")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=27")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("Describes a value that is an integer between −9,223,372,036,854,775,808 and 9,223,372,036,854,775,807.")
attrs.DisplayName = ua.LocalizedText("Int64")
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=8")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=27")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=9")
node.BrowseName = ua.QualifiedName.from_string("UInt64")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ReferenceTypeAttributes()
attrs.Description = ua.LocalizedText("The type for non-looping hierarchical references that are used to aggregate nodes into complex types.")
attrs.DisplayName = ua.LocalizedText("Aggregates")
attrs.InverseName = ua.LocalizedText("AggregatedBy")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=45")
node.BrowseName = ua.QualifiedName.from_string("HasSubtype")
node.NodeClass = ua.NodeClass.ReferenceType
node.ParentNodeId = ua.NodeId.from_string("i=34")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ReferenceTypeAttributes()
attrs.Description = ua.LocalizedText("The type for non-looping hierarchical references that are used to define sub types.")
attrs.DisplayName = ua.LocalizedText("HasSubtype")
attrs.InverseName = ua.LocalizedText("HasSupertype")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=46")
node.BrowseName = ua.QualifiedName.from_string("HasProperty")
node.NodeClass = ua.NodeClass.ReferenceType
node.ParentNodeId = ua.NodeId.from_string("i=44")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ReferenceTypeAttributes()
attrs.Description = ua.LocalizedText("The type for non-looping hierarchical reference from a node to its property.")
attrs.DisplayName = ua.LocalizedText("HasProperty")
attrs.InverseName = ua.LocalizedText("PropertyOf")
node.NodeAttributes = attrs
ref.IsForward = True
ref.ReferenceTypeId = NumericNodeId(40, 0)
ref.SourceNodeId = NumericNodeId(2343, 0)
ref.TargetNodeClass = NodeClass.DataType
ref.TargetNodeId = NumericNodeId(2340, 0)
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = NumericNodeId(11285, 0)
node.BrowseName = QualifiedName('TimeAverage2', 0)
node.NodeClass = NodeClass.Object
node.TypeDefinition = NumericNodeId(2340, 0)
attrs = ua.ObjectAttributes()
attrs.Description = LocalizedText("Retrieve the time weighted average data over the interval using Simple Bounding Values.")
attrs.DisplayName = LocalizedText("TimeAverage2")
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(11285, 0)
ref.TargetNodeClass = NodeClass.DataType
ref.TargetNodeId = NumericNodeId(2340, 0)
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = NumericNodeId(2344, 0)
node.BrowseName = QualifiedName('Total', 0)
ref.ReferenceTypeId = ua.NodeId.from_string("i=45")
ref.SourceNodeId = ua.NodeId.from_string("i=3065")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=32")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=44")
node.BrowseName = ua.QualifiedName.from_string("Aggregates")
node.NodeClass = ua.NodeClass.ReferenceType
node.ParentNodeId = ua.NodeId.from_string("i=34")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ReferenceTypeAttributes()
attrs.Description = ua.LocalizedText("The type for non-looping hierarchical references that are used to aggregate nodes into complex types.")
attrs.DisplayName = ua.LocalizedText("Aggregates")
attrs.InverseName = ua.LocalizedText("AggregatedBy")
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=44")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=34")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=45")
node.BrowseName = ua.QualifiedName.from_string("HasSubtype")
ref.IsForward = True
ref.ReferenceTypeId = NumericNodeId(40, 0)
ref.SourceNodeId = NumericNodeId(11428, 0)
ref.TargetNodeClass = NodeClass.DataType
ref.TargetNodeId = NumericNodeId(2340, 0)
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = NumericNodeId(11429, 0)
node.BrowseName = QualifiedName('VariancePopulation', 0)
node.NodeClass = NodeClass.Object
node.TypeDefinition = NumericNodeId(2340, 0)
attrs = ua.ObjectAttributes()
attrs.Description = LocalizedText("Retrieve the variance for the interval as calculated by the StandardDeviationPopulation which includes Simple Bounding Values.")
attrs.DisplayName = LocalizedText("VariancePopulation")
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(11429, 0)
ref.TargetNodeClass = NodeClass.DataType
ref.TargetNodeId = NumericNodeId(2340, 0)
refs.append(ref)
server.add_references(refs)
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("b'A software certificate with a digital signature.'")
attrs.DisplayName = ua.LocalizedText("SignedSoftwareCertificate")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=388")
node.BrowseName = ua.QualifiedName.from_string("SessionAuthenticationToken")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=17")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("b'A unique identifier for a session used to authenticate requests.'")
attrs.DisplayName = ua.LocalizedText("SessionAuthenticationToken")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=316")
node.BrowseName = ua.QualifiedName.from_string("UserIdentityToken")
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.Description = ua.LocalizedText("b'A base type for a user identity token.'")
attrs.DisplayName = ua.LocalizedText("UserIdentityToken")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("A token representing a user identified by a user name and password.")
attrs.DisplayName = ua.LocalizedText("UserNameIdentityToken")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=325")
node.BrowseName = ua.QualifiedName.from_string("X509IdentityToken")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=316")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("A token representing a user identified by an X509 certificate.")
attrs.DisplayName = ua.LocalizedText("X509IdentityToken")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=12504")
node.BrowseName = ua.QualifiedName.from_string("KerberosIdentityToken")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=316")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.DisplayName = ua.LocalizedText("KerberosIdentityToken")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=938")
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=40")
ref.SourceNodeId = ua.NodeId.from_string("i=11498")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=68")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=12908")
node.BrowseName = ua.QualifiedName.from_string("MaxByteStringLength")
node.NodeClass = ua.NodeClass.Variable
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.Description = ua.LocalizedText("The maximum length for a byte string that can be stored in the owning variable.")
attrs.DisplayName = ua.LocalizedText("MaxByteStringLength")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -2
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=40")
ref.SourceNodeId = ua.NodeId.from_string("i=12908")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=68")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=11512")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("Describes a value that is a structure containing diagnostics associated with a StatusCode.")
attrs.DisplayName = ua.LocalizedText("DiagnosticInfo")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=288")
node.BrowseName = ua.QualifiedName.from_string("IntegerId")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=7")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("A numeric identifier for an object.")
attrs.DisplayName = ua.LocalizedText("IntegerId")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=307")
node.BrowseName = ua.QualifiedName.from_string("ApplicationType")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=29")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.Description = ua.LocalizedText("The types of applications.")
attrs.DisplayName = ua.LocalizedText("ApplicationType")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()