Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReferenceDescriptions for TypeDefinition #1796

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified asyncua/binary_address_space.pickle
Binary file not shown.
3 changes: 3 additions & 0 deletions asyncua/common/xmlimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,9 @@ def add_to_sorted(nid, ndata):
if ndata.datatype is not None and ndata.datatype in all_nodes:
if ndata.datatype not in sorted_nodes:
continue
if ndata.typedef is not None and ndata.typedef in all_nodes:
if ndata.typedef not in sorted_nodes:
continue
if ndata.parent is None or ndata.parent not in all_nodes:
add_to_sorted(nid, ndata)
else:
Expand Down
8 changes: 6 additions & 2 deletions asyncua/server/address_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ def _add_node(self, item: ua.AddNodesItem, user: User, check: bool = True) -> ua
result.StatusCode = ua.StatusCode(ua.StatusCodes.BadBrowseNameDuplicated)
return result

if not item.TypeDefinition.is_null() and item.TypeDefinition not in self._aspace:
result.StatusCode = ua.StatusCode(ua.StatusCodes.BadTypeDefinitionInvalid)
return result

nodedata = NodeData(item.RequestedNewNodeId)

self._add_node_attributes(nodedata, item, add_timestamps=check)
Expand All @@ -340,7 +344,7 @@ def _add_node(self, item: ua.AddNodesItem, user: User, check: bool = True) -> ua
self._add_ref_to_parent(nodedata, item, parentdata)

# add type definition
if item.TypeDefinition != ua.NodeId():
if not item.TypeDefinition.is_null():
self._add_type_definition(nodedata, item)

result.StatusCode = ua.StatusCode()
Expand Down Expand Up @@ -399,7 +403,7 @@ def _add_type_definition(self, nodedata: NodeData, item: ua.AddNodesItem):
addref.IsForward = True # FIXME in uaprotocol_auto.py
addref.ReferenceTypeId = ua.NodeId(ua.ObjectIds.HasTypeDefinition)
addref.TargetNodeId = item.TypeDefinition
addref.TargetNodeClass = ua.NodeClass.DataType
addref.TargetNodeClass = ua.NodeClass.Unspecified
self._add_reference_no_check(nodedata, addref) # FIXME return StatusCode is not evaluated

def delete_nodes(
Expand Down