refactor(opcuaclient): remove vestigial TargetNamespaceKind + UnsMappingTable (#648)
Nothing read the mapping table beyond the startup validator; v3 UNS projection is
explicit via UnsTagReference. Legacy keys in stored DriverConfig are ignored (pinned).
Reverts the docker-dev opc-plc seed workaround from fdee129f.
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -241,10 +241,6 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
if (HasConfigBody(driverConfigJson))
|
||||
_options = OpcUaClientDriverFactoryExtensions.ParseOptions(_driverInstanceId, driverConfigJson);
|
||||
|
||||
// Enforce the Equipment-vs-SystemPlatform choice at startup per driver-specs.md
|
||||
// §8 "Namespace Assignment" — a misconfigured remote fails draft validation here,
|
||||
// not as a runtime surprise.
|
||||
ValidateNamespaceKind(_options);
|
||||
ValidateTuning(_options);
|
||||
|
||||
var appConfig = await BuildApplicationConfigurationAsync(cancellationToken).ConfigureAwait(false);
|
||||
@@ -643,42 +639,6 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
return effective < TimeSpan.FromMilliseconds(50) ? 50 : (int)effective.TotalMilliseconds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enforce the §8 "Namespace Assignment" rule at startup. An <c>Equipment</c>-kind
|
||||
/// instance gateways raw equipment data and therefore needs a config-driven UNS
|
||||
/// mapping table (remote nodes don't conform to UNS); a <c>SystemPlatform</c>-kind
|
||||
/// instance gateways processed data whose hierarchy is preserved verbatim, so a
|
||||
/// UNS mapping table is meaningless and rejected. Throwing here surfaces the
|
||||
/// misconfiguration as a draft-validation failure rather than a runtime surprise.
|
||||
/// </summary>
|
||||
/// <param name="opts">Driver options containing namespace configuration.</param>
|
||||
internal static void ValidateNamespaceKind(OpcUaClientDriverOptions opts)
|
||||
{
|
||||
switch (opts.TargetNamespaceKind)
|
||||
{
|
||||
case OpcUaTargetNamespaceKind.Equipment:
|
||||
if (opts.UnsMappingTable is null || opts.UnsMappingTable.Count == 0)
|
||||
throw new InvalidOperationException(
|
||||
"OpcUaClient driver configured with TargetNamespaceKind=Equipment but no " +
|
||||
"UnsMappingTable: §8 requires a config-driven remote-to-UNS mapping table " +
|
||||
"because remote nodes do not conform to UNS by default. Provide a mapping " +
|
||||
"table or set TargetNamespaceKind=SystemPlatform if the remote exposes " +
|
||||
"processed data.");
|
||||
break;
|
||||
case OpcUaTargetNamespaceKind.SystemPlatform:
|
||||
if (opts.UnsMappingTable is { Count: > 0 })
|
||||
throw new InvalidOperationException(
|
||||
"OpcUaClient driver configured with TargetNamespaceKind=SystemPlatform but " +
|
||||
"a UnsMappingTable was supplied: processed data preserves its own hierarchy " +
|
||||
"and a UNS mapping table is ambiguous here. Clear the mapping table or set " +
|
||||
"TargetNamespaceKind=Equipment if the remote exposes raw equipment data.");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(opts), opts.TargetNamespaceKind, "Unknown TargetNamespaceKind.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build the user-identity token from the driver options. Split out of
|
||||
/// <see cref="InitializeAsync"/> so the failover sweep reuses one identity across
|
||||
|
||||
Reference in New Issue
Block a user