Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
049e7c1
Merge branch 'marcschier/wot-02-sourcegen' into marcschier/wot-10-wot…
marcschier Jul 31, 2026
84a2831
Add the WoT Connectivity 1.1 information model
marcschier Jul 31, 2026
381c15e
Qualify the core identifier references shadowed by the combined model
marcschier Jul 31, 2026
a88b971
Partition WoT-Con predefined nodes for legacy manager
marcschier Jul 31, 2026
997d2b6
Add the fluent builder API the generated node managers require
marcschier Jul 31, 2026
13534d1
Wire the data-type lookup into the DI node manager builder
marcschier Jul 31, 2026
80cb76c
Trigger merge recomputation
marcschier Jul 31, 2026
b20b7b9
Merge branch 'marcschier/wot-04-generator-wot' into marcschier/wot-10…
marcschier Jul 31, 2026
572f905
Fix method argument name generation concurrency
marcschier Jul 31, 2026
06707cf
Merge branch 'marcschier/wot-04-generator-wot' into marcschier/wot-10…
marcschier Jul 31, 2026
66ccab9
Merge branch 'marcschier/wot-04-generator-wot' into marcschier/wot-10…
marcschier Jul 31, 2026
abc2009
Merge branch 'marcschier/wot-04-generator-wot' into marcschier/wot-10…
marcschier Aug 1, 2026
32401f4
Merge branch 'marcschier/wot-09-xregistry-client' into marcschier/wot…
marcschier Aug 1, 2026
059a4e1
Merge branch 'marcschier/wot-09-xregistry-client' into marcschier/wot…
marcschier Aug 1, 2026
1ae01a3
Use the path-qualified generated method types
marcschier Aug 1, 2026
432a545
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 2, 2026
ec16a9b
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
665eb63
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
b04d0fe
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
c6d5bbb
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
aaab77e
Treat the WoT management minimum security mode as a floor
marcschier Aug 3, 2026
917997a
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
772a61a
Merge remote-tracking branch 'origin/marcschier/wot-09-xregistry-clie…
marcschier Aug 3, 2026
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
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<PublishAot>false</PublishAot>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoWarn>$(NoWarn);CS2008;CA1014;CA1016</NoWarn>
<!-- The no-op shell strips all references, so on netstandard2.x there is no
assembly providing System.Object; supply an explicit RuntimeMetadataVersion
so the empty assembly still compiles (net4x get it from the targeting pack). -->
Expand Down
6 changes: 3 additions & 3 deletions src/Opc.Ua.WotCon.Server/Assets/AssetRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ private void BuildPropertyNode(AssetEntry entry, string name, WotProperty proper
BrowseName = new QualifiedName(name, ns),
DisplayName = new LocalizedText(property.Title ?? name),
Description = property.Description != null ? new LocalizedText(property.Description) : LocalizedText.Null,
DataType = mapped ? dataType : DataTypeIds.BaseDataType,
DataType = mapped ? dataType : Ua.DataTypeIds.BaseDataType,
ValueRank = mapped ? valueRank : ValueRanks.Scalar,
AccessLevel = property.ReadOnly ? AccessLevels.CurrentRead : AccessLevels.CurrentReadOrWrite,
UserAccessLevel = property.ReadOnly ? AccessLevels.CurrentRead : AccessLevels.CurrentReadOrWrite,
Expand Down Expand Up @@ -721,7 +721,7 @@ private void BuildActionNode(AssetEntry entry, string name, WotAction action)
inputProperty.NodeId = m_manager.AllocateChildNodeId(entry.Name, "actions", name + "_in");
inputProperty.BrowseName = new QualifiedName(Ua.BrowseNames.InputArguments);
inputProperty.DisplayName = new LocalizedText(Ua.BrowseNames.InputArguments);
inputProperty.DataType = DataTypeIds.Argument;
inputProperty.DataType = Ua.DataTypeIds.Argument;
inputProperty.ValueRank = ValueRanks.OneDimension;
inputProperty.ReferenceTypeId = Ua.ReferenceTypeIds.HasProperty;
inputProperty.TypeDefinitionId = VariableTypeIds.PropertyType;
Expand All @@ -741,7 +741,7 @@ private void BuildActionNode(AssetEntry entry, string name, WotAction action)
outputProperty.NodeId = m_manager.AllocateChildNodeId(entry.Name, "actions", name + "_out");
outputProperty.BrowseName = new QualifiedName(Ua.BrowseNames.OutputArguments);
outputProperty.DisplayName = new LocalizedText(Ua.BrowseNames.OutputArguments);
outputProperty.DataType = DataTypeIds.Argument;
outputProperty.DataType = Ua.DataTypeIds.Argument;
outputProperty.ValueRank = ValueRanks.OneDimension;
outputProperty.ReferenceTypeId = Ua.ReferenceTypeIds.HasProperty;
outputProperty.TypeDefinitionId = VariableTypeIds.PropertyType;
Expand Down
3 changes: 2 additions & 1 deletion src/Opc.Ua.WotCon.Server/Assets/WotAssetFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public WotAssetFileManager(
file.Write?.OnCall = new WriteMethodStateMethodCallHandler(OnWrite);
file.GetPosition?.OnCall = new GetPositionMethodStateMethodCallHandler(OnGetPosition);
file.SetPosition?.OnCall = new SetPositionMethodStateMethodCallHandler(OnSetPosition);
file.CloseAndUpdate?.OnCall = new CloseAndUpdateMethodStateMethodCallHandler(OnCloseAndUpdate);
file.CloseAndUpdate?.OnCall =
new CloseAndUpdateIWoTAssetTypeWoTFileMethodStateMethodCallHandler(OnCloseAndUpdate);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Opc.Ua.WotCon.Server/ThingDescriptions/WotActionMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static IReadOnlyList<Argument> BuildArguments(WotActionSchema? schema)
new Argument
{
Name = schema.Title ?? "value",
DataType = DataTypeIds.BaseDataType,
DataType = Ua.DataTypeIds.BaseDataType,
ValueRank = ValueRanks.Scalar,
Description = BuildSchemaDescription(schema)
}
Expand All @@ -90,7 +90,7 @@ private static Argument BuildMemberArgument(string name, WotActionMember member)

if (!WotPropertyMapper.TryMapPrimitive(jsonType, out NodeId dataType))
{
dataType = DataTypeIds.BaseDataType;
dataType = Ua.DataTypeIds.BaseDataType;
}

return new Argument
Expand Down
12 changes: 6 additions & 6 deletions src/Opc.Ua.WotCon.Server/ThingDescriptions/WotPropertyMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static bool TryMap(
valueRank = ValueRanks.OneDimension;
if (property.Items?.Type == null)
{
dataType = DataTypeIds.BaseDataType;
dataType = Ua.DataTypeIds.BaseDataType;
return true;
}
return TryMapPrimitive(property.Items.Type, out dataType);
Expand All @@ -90,16 +90,16 @@ public static bool TryMapPrimitive(string? jsonType, out NodeId dataType)
switch (jsonType?.ToLowerInvariant())
{
case "boolean":
dataType = DataTypeIds.Boolean;
dataType = Ua.DataTypeIds.Boolean;
return true;
case "number":
dataType = DataTypeIds.Double;
dataType = Ua.DataTypeIds.Double;
return true;
case "integer":
dataType = DataTypeIds.Int64;
dataType = Ua.DataTypeIds.Int64;
return true;
case "string":
dataType = DataTypeIds.String;
dataType = Ua.DataTypeIds.String;
return true;
case null:
case "":
Expand All @@ -108,7 +108,7 @@ public static bool TryMapPrimitive(string? jsonType, out NodeId dataType)
dataType = NodeId.Null;
return false;
default:
dataType = DataTypeIds.BaseDataType;
dataType = Ua.DataTypeIds.BaseDataType;
return true;
}
}
Expand Down
127 changes: 127 additions & 0 deletions src/Opc.Ua.WotCon.Server/WotConModelPartition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/* ========================================================================
* Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

using Opc.Ua.XRegistry;

namespace Opc.Ua.WotCon.Server
{
/// <summary>
/// Splits the single combined WoT Connectivity 1.1 model
/// (<c>http://opcfoundation.org/UA/WoT-Con/</c>) into the two disjoint
/// static-node slices its NodeManagers own, so the deprecated 1.02 surface
/// and the additive registry surface are never claimed twice when both the
/// <see cref="WotConnectivityNodeManager"/> and the
/// <c>WotRegistryNodeManager</c> operate on the same server.
/// </summary>
/// <remarks>
/// The combined NodeSet incorporates the published OPC 10100-1 v1.02 model
/// at its original NodeIds (<c>1..172</c>, marked deprecated) plus the
/// additive registry nodes in the provisional <c>64000+</c> block.
/// Ownership is therefore decided by NodeId: the legacy asset manager owns
/// the incorporated 1.02 nodes and the registry manager owns the registry
/// nodes (together with the xRegistry base nodes it also loads).
/// </remarks>
internal static class WotConModelPartition
{
/// <summary>
/// First NodeId of the additive registry block. NodeIds below this
/// value belong to the incorporated OPC 10100-1 v1.02 surface.
/// </summary>
public const uint FirstRegistryNodeId = 64000;

/// <summary>
/// Ensures the xRegistry namespace is present so the combined model's
/// registry nodes (which reference xRegistry base types while being
/// created) can be instantiated before the registry slice is removed.
/// The legacy manager does not own the xRegistry namespace; it merely
/// needs the URI registered so <see cref="NodeId.Create(uint, string,
/// NamespaceTable)"/> resolves during predefined-node creation.
/// </summary>
public static void EnsureXRegistryNamespace(ISystemContext context)
{
context.NamespaceUris.GetIndexOrAppend(XRegistryWellKnown.XRegistryNamespaceUri);
}

/// <summary>
/// Removes the additive registry nodes, retaining only the incorporated
/// OPC 10100-1 v1.02 surface for the legacy asset manager to own.
/// </summary>
public static NodeStateCollection RetainLegacyNodes(
NodeStateCollection nodes, ISystemContext context)
{
ushort modelNs = ModelNamespaceIndex(context);
for (int i = nodes.Count - 1; i >= 0; i--)
{
if (IsRegistryNode(nodes[i], modelNs))
{
nodes.RemoveAt(i);
}
}
return nodes;
}

/// <summary>
/// Removes the incorporated OPC 10100-1 v1.02 nodes, retaining only the
/// additive registry nodes (and any xRegistry base nodes already in the
/// collection) for the registry manager to own.
/// </summary>
public static NodeStateCollection RetainRegistryNodes(
NodeStateCollection nodes, ISystemContext context)
{
ushort modelNs = ModelNamespaceIndex(context);
for (int i = nodes.Count - 1; i >= 0; i--)
{
if (IsLegacyNode(nodes[i], modelNs))
{
nodes.RemoveAt(i);
}
}
return nodes;
}

private static ushort ModelNamespaceIndex(ISystemContext context)
{
return (ushort)context.NamespaceUris.GetIndex(Namespaces.WotCon);
}

private static bool IsRegistryNode(NodeState node, ushort modelNs)
{
return node.NodeId.NamespaceIndex == modelNs &&
node.NodeId.TryGetValue(out uint id) &&
id >= FirstRegistryNodeId;
}

private static bool IsLegacyNode(NodeState node, ushort modelNs)
{
return node.NodeId.NamespaceIndex == modelNs &&
node.NodeId.TryGetValue(out uint id) &&
id < FirstRegistryNodeId;
}
}
}
48 changes: 33 additions & 15 deletions src/Opc.Ua.WotCon.Server/WotConnectivityNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ namespace Opc.Ua.WotCon.Server
/// <remarks>
/// The static model nodes — <c>WoTAssetConnectionManagement</c>, all
/// type definitions, and the <c>HasWoTComponent</c> reference type —
/// are loaded from the generated <c>AddOpcUaWotCon</c> table. Dynamic
/// nodes (assets, property variables, action methods) are created
/// per asset by <see cref="AssetRegistry"/> in a dedicated namespace
/// are loaded from the generated <c>AddOpcUaWotCon</c> table, restricted to
/// the incorporated OPC 10100-1 v1.02 surface (NodeIds below the additive
/// registry block). The additive registry nodes in the same combined model
/// are owned by <c>WotRegistryNodeManager</c>. Dynamic nodes (assets,
/// property variables, action methods) are created per asset by
/// <see cref="AssetRegistry"/> in a dedicated namespace
/// (<see cref="WotConnectivityServerOptions.AssetNamespaceUri"/>).
/// </remarks>
public sealed class WotConnectivityNodeManager : AsyncCustomNodeManager, INodeIdFactory
Expand Down Expand Up @@ -170,7 +173,15 @@ protected override ValueTask<NodeStateCollection> LoadPredefinedNodesAsync(
ISystemContext context,
CancellationToken cancellationToken = default)
{
return new ValueTask<NodeStateCollection>(new NodeStateCollection().AddOpcUaWotCon(context));
// The combined WoT-Con model incorporates both the deprecated 1.02
// surface and the additive registry nodes (which reference xRegistry
// base types). Register the xRegistry namespace so the combined table
// can be created, then keep only the 1.02 slice: the registry nodes
// are owned by WotRegistryNodeManager.
WotConModelPartition.EnsureXRegistryNamespace(context);
NodeStateCollection nodes = new NodeStateCollection().AddOpcUaWotCon(context);
WotConModelPartition.RetainLegacyNodes(nodes, context);
return new ValueTask<NodeStateCollection>(nodes);
}

/// <inheritdoc/>
Expand Down Expand Up @@ -444,7 +455,7 @@ private void ApplyConfiguration(ISystemContext context, WoTAssetConnectionManage
}
}

private async ValueTask<CreateAssetMethodStateResult> OnCreateAssetAsync(
private async ValueTask<CreateAssetWoTAssetConnectionManagementTypeMethodStateResult> OnCreateAssetAsync(
ISystemContext context,
MethodState method,
NodeId objectId,
Expand All @@ -454,10 +465,14 @@ private async ValueTask<CreateAssetMethodStateResult> OnCreateAssetAsync(
EnforceManagementAccess(context, "CreateAsset");
(ServiceResult status, NodeId assetId) = await m_registry
.CreateAssetAsync(assetName, cancellationToken).ConfigureAwait(false);
return new CreateAssetMethodStateResult { ServiceResult = status, AssetId = assetId.IsNull ? NodeId.Null : assetId };
return new CreateAssetWoTAssetConnectionManagementTypeMethodStateResult
{
ServiceResult = status,
AssetId = assetId.IsNull ? NodeId.Null : assetId
};
}

private async ValueTask<DeleteAssetMethodStateResult> OnDeleteAssetAsync(
private async ValueTask<DeleteAssetWoTAssetConnectionManagementTypeMethodStateResult> OnDeleteAssetAsync(
ISystemContext context,
MethodState method,
NodeId objectId,
Expand All @@ -467,10 +482,10 @@ private async ValueTask<DeleteAssetMethodStateResult> OnDeleteAssetAsync(
EnforceManagementAccess(context, "DeleteAsset");
ServiceResult status = await m_registry
.DeleteAssetAsync(assetId, cancellationToken).ConfigureAwait(false);
return new DeleteAssetMethodStateResult { ServiceResult = status };
return new DeleteAssetWoTAssetConnectionManagementTypeMethodStateResult { ServiceResult = status };
}

private async ValueTask<DiscoverAssetsMethodStateResult> OnDiscoverAssetsAsync(
private async ValueTask<DiscoverAssetsWoTAssetConnectionManagementTypeMethodStateResult> OnDiscoverAssetsAsync(
ISystemContext context,
MethodState method,
NodeId objectId,
Expand All @@ -484,14 +499,14 @@ private async ValueTask<DiscoverAssetsMethodStateResult> OnDiscoverAssetsAsync(
{
arr[i] = endpoints[i];
}
return new DiscoverAssetsMethodStateResult
return new DiscoverAssetsWoTAssetConnectionManagementTypeMethodStateResult
{
ServiceResult = status,
AssetEndpoints = new ArrayOf<string>(arr)
};
}

private async ValueTask<CreateAssetForEndpointMethodStateResult> OnCreateAssetForEndpointAsync(
private async ValueTask<CreateAssetForEndpointWoTAssetConnectionManagementTypeMethodStateResult> OnCreateAssetForEndpointAsync(
ISystemContext context,
MethodState method,
NodeId objectId,
Expand All @@ -503,14 +518,14 @@ private async ValueTask<CreateAssetForEndpointMethodStateResult> OnCreateAssetFo
(ServiceResult status, NodeId assetId) = await m_registry
.CreateAssetForEndpointAsync(assetName, assetEndpoint, cancellationToken)
.ConfigureAwait(false);
return new CreateAssetForEndpointMethodStateResult
return new CreateAssetForEndpointWoTAssetConnectionManagementTypeMethodStateResult
{
ServiceResult = status,
AssetId = assetId.IsNull ? NodeId.Null : assetId
};
}

private async ValueTask<ConnectionTestMethodStateResult> OnConnectionTestAsync(
private async ValueTask<ConnectionTestWoTAssetConnectionManagementTypeMethodStateResult> OnConnectionTestAsync(
ISystemContext context,
MethodState method,
NodeId objectId,
Expand All @@ -520,7 +535,7 @@ private async ValueTask<ConnectionTestMethodStateResult> OnConnectionTestAsync(
EnforceManagementAccess(context, "ConnectionTest");
(ServiceResult status, bool success, string text) = await m_registry
.ConnectionTestAsync(assetEndpoint, cancellationToken).ConfigureAwait(false);
return new ConnectionTestMethodStateResult
return new ConnectionTestWoTAssetConnectionManagementTypeMethodStateResult
{
ServiceResult = status,
Success = success,
Expand Down Expand Up @@ -563,7 +578,10 @@ internal void EnforceManagementAccess(ISystemContext context, string operation)
MessageSecurityMode securityMode = operationContext.ChannelContext?
.EndpointDescription?.SecurityMode ??
MessageSecurityMode.None;
if (securityMode != policy.MinimumSecurityMode)
// MinimumSecurityMode is a floor, not an exact match: MessageSecurityMode is ordered by
// strength (Invalid < None < Sign < SignAndEncrypt), so a channel at or above the
// configured mode is accepted and Invalid is always rejected.
if (securityMode < policy.MinimumSecurityMode)
{
m_logger.ManagementCallDeniedSecurityMode(operation, securityMode, policy.MinimumSecurityMode);
throw new ServiceResultException(
Expand Down
2 changes: 1 addition & 1 deletion src/Opc.Ua.WotCon.Server/WotConnectivityServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public sealed class WotConnectivityServerOptions
public sealed class WotConfigurationParameter
{
/// <summary>The OPC UA <c>DataType</c> for the parameter.</summary>
public NodeId DataType { get; init; } = DataTypeIds.String;
public NodeId DataType { get; init; } = Ua.DataTypeIds.String;

/// <summary>The initial value (must be assignable to a <c>Variant</c>).</summary>
public Variant? InitialValue { get; init; }
Expand Down
Loading
Loading