Server: Implement service DeleteNodes
Description
Implement DeleteNodes: OPC UA 1.05 part 4 5.7.4:
This Service is used to delete one or more Nodes from the AddressSpace.
When any of the Nodes deleted by an invocation of this Service is the TargetNode of a Reference, then those References are left unresolved based on the deleteTargetReferences parameter.
Servers may delete additional Nodes and References like child Nodes that exist based on a TypeDefinition. The behaviour is Server specific. When any of the Nodes deleted by an invocation of this Service is being monitored, then a Notification containing the status code Bad_NodeIdUnknown is sent to the monitoring Client indicating that the Node has been deleted.
Detailed description
Implemented version: Delete the requested node, its references (as a source) and reciprocal references (as a target). The child nodes referenced by HasChild (and Organizes) types and subtypes are also deleted recursively when they become orphaned (no other parent).
This latter part behavior is configurable at S2OPC compilation time by using the new compilation definition variables. Default behavior is defined in CMake configuration file and is modifiable using build.sh script or CMake definition:
option(S2OPC_NODE_MANAGEMENT "Make NodeManagement service set available to clients" OFF)
option(S2OPC_NODE_DELETE_CHILD_NODES "Make DeleteNodes service recursively delete new orphans child nodes" ON)
option(S2OPC_NODE_DELETE_ORGANIZES_CHILD_NODES "Make DeleteNodes service delete child nodes with Organizes hierarchical references" ON)
S2OPC_NODE_MANAGEMENT activation is necessary to make the service accessible to clients, it is accessible locally in server if the address space is not constant.
Recursion depth limit is defined by value of the compilation variable definition: SOPC_DEFAULT_MAX_STRUCT_NESTED_LEVEL (50 by default)
Code version identification
Current master: f7dc764a
Security impact
No security impact identified. Delete nodes rights should be configured accordingly to
Known limitations
When deleteTargetReferences is used only the references that are reciprocal to the references of the source node deleted are considered, thus only references in target nodes where the deleted node is the target are deleted. i.e. address space nodes are not fully iterated to find any reference in which the deleted node is the target.
As a consequence, the status code Uncertain_ReferenceNotDeleted is always returned when deleteTargetReferences is set since there is no guarantee that all references were deleted (it depends if the configured address space was containing all reciprocal references or not).