Skip to content
Snippets Groups Projects
Commit b5469626 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-343: Remove hack if namespace doesn't exist (because it does now in our...

L2SS-343: Remove hack if namespace doesn't exist (because it does now in our servers), and prepend the namespace index for any path element that does not have it explicitly set.
parent 8f3a8dd7
No related branches found
No related tags found
1 merge request!122L2SS-343: Remove hack if lofar.eu namespace doesn't exist
......@@ -52,16 +52,12 @@ class OPCUAConnection(CommClient):
# determine namespace used
try:
if type(namespace) is str:
self.name_space_index = self.client.get_namespace_index(namespace)
elif type(namespace) is int:
self.name_space_index = namespace
except Exception as e:
#TODO remove once SDP is fixed
self.streams.warn_stream("Cannot determine the OPC-UA name space index. Will try and use the default = 2.")
self.name_space_index = 2
else:
raise TypeError(f"namespace must be of type str or int, but is of type {type(namespace).__name__}")
self.obj = self.client.get_objects_node()
self.check_nodes()
......@@ -136,6 +132,9 @@ class OPCUAConnection(CommClient):
else:
raise Exception("OPC-ua mapping requires either a list of the path or dict with the path. Was given %s type containing: %s", type(annotation), annotation)
# prepend namespace index for each element if none is given
path = [name if ':' in name else f'{self.name_space_index}:{name}' for name in path]
try:
node = self.obj.get_child(path)
except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment