Phase 0 — mechanical rename ZB.MOM.WW.LmxOpcUa.* → ZB.MOM.WW.OtOpcUa.*

Renames all 11 projects (5 src + 6 tests), the .slnx solution file, all source-file namespaces, all axaml namespace references, and all v1 documentation references in CLAUDE.md and docs/*.md (excluding docs/v2/ which is already in OtOpcUa form). Also updates the TopShelf service registration name from "LmxOpcUa" to "OtOpcUa" per Phase 0 Task 0.6.

Preserves runtime identifiers per Phase 0 Out-of-Scope rules to avoid breaking v1/v2 client trust during coexistence: OPC UA `ApplicationUri` defaults (`urn:{GalaxyName}:LmxOpcUa`), server `EndpointPath` (`/LmxOpcUa`), `ServerName` default (feeds cert subject CN), `MxAccessConfiguration.ClientName` default (defensive — stays "LmxOpcUa" for MxAccess audit-trail consistency), client OPC UA identifiers (`ApplicationName = "LmxOpcUaClient"`, `ApplicationUri = "urn:localhost:LmxOpcUaClient"`, cert directory `%LocalAppData%\LmxOpcUaClient\pki\`), and the `LmxOpcUaServer` class name (class rename out of Phase 0 scope per Task 0.5 sed pattern; happens in Phase 1 alongside `LmxNodeManager → GenericDriverNodeManager` Core extraction). 23 LmxOpcUa references retained, all enumerated and justified in `docs/v2/implementation/exit-gate-phase-0.md`.

Build clean: 0 errors, 30 warnings (lower than baseline 167). Tests at strict improvement over baseline: 821 passing / 1 failing vs baseline 820 / 2 (one flaky pre-existing failure passed this run; the other still fails — both pre-existing and unrelated to the rename). `Client.UI.Tests`, `Historian.Aveva.Tests`, `Client.Shared.Tests`, `IntegrationTests` all match baseline exactly. Exit gate compliance results recorded in `docs/v2/implementation/exit-gate-phase-0.md` with all 7 checks PASS or DEFERRED-to-PR-review (#7 service install verification needs Windows service permissions on the reviewer's box).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-04-17 13:57:47 -04:00
parent 5b8d708c58
commit 3b2defd94f
293 changed files with 841 additions and 722 deletions

View File

@@ -0,0 +1,28 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Aggregate functions for processed history reads.
/// </summary>
public enum AggregateType
{
/// <summary>Average of values in the interval.</summary>
Average,
/// <summary>Minimum value in the interval.</summary>
Minimum,
/// <summary>Maximum value in the interval.</summary>
Maximum,
/// <summary>Count of values in the interval.</summary>
Count,
/// <summary>First value in the interval.</summary>
Start,
/// <summary>Last value in the interval.</summary>
End,
/// <summary>Population standard deviation of values in the interval.</summary>
StandardDeviation
}

View File

@@ -0,0 +1,61 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Event data for an alarm or condition notification from the OPC UA server.
/// </summary>
public sealed class AlarmEventArgs : EventArgs
{
public AlarmEventArgs(
string sourceName,
string conditionName,
ushort severity,
string message,
bool retain,
bool activeState,
bool ackedState,
DateTime time,
byte[]? eventId = null,
string? conditionNodeId = null)
{
SourceName = sourceName;
ConditionName = conditionName;
Severity = severity;
Message = message;
Retain = retain;
ActiveState = activeState;
AckedState = ackedState;
Time = time;
EventId = eventId;
ConditionNodeId = conditionNodeId;
}
/// <summary>The name of the source object that raised the alarm.</summary>
public string SourceName { get; }
/// <summary>The condition type name.</summary>
public string ConditionName { get; }
/// <summary>The alarm severity (0-1000).</summary>
public ushort Severity { get; }
/// <summary>Human-readable alarm message.</summary>
public string Message { get; }
/// <summary>Whether the alarm should be retained in the display.</summary>
public bool Retain { get; }
/// <summary>Whether the alarm condition is currently active.</summary>
public bool ActiveState { get; }
/// <summary>Whether the alarm has been acknowledged.</summary>
public bool AckedState { get; }
/// <summary>The time the event occurred.</summary>
public DateTime Time { get; }
/// <summary>The EventId used for alarm acknowledgment.</summary>
public byte[]? EventId { get; }
/// <summary>The NodeId of the condition instance (SourceNode), used for acknowledgment.</summary>
public string? ConditionNodeId { get; }
}

View File

@@ -0,0 +1,35 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Represents a single node in the browse result set.
/// </summary>
public sealed class BrowseResult
{
public BrowseResult(string nodeId, string displayName, string nodeClass, bool hasChildren)
{
NodeId = nodeId;
DisplayName = displayName;
NodeClass = nodeClass;
HasChildren = hasChildren;
}
/// <summary>
/// The string representation of the node's NodeId.
/// </summary>
public string NodeId { get; }
/// <summary>
/// The display name of the node.
/// </summary>
public string DisplayName { get; }
/// <summary>
/// The node class (e.g., "Object", "Variable", "Method").
/// </summary>
public string NodeClass { get; }
/// <summary>
/// Whether the node has child references.
/// </summary>
public bool HasChildren { get; }
}

View File

@@ -0,0 +1,41 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Information about the current OPC UA session.
/// </summary>
public sealed class ConnectionInfo
{
public ConnectionInfo(
string endpointUrl,
string serverName,
string securityMode,
string securityPolicyUri,
string sessionId,
string sessionName)
{
EndpointUrl = endpointUrl;
ServerName = serverName;
SecurityMode = securityMode;
SecurityPolicyUri = securityPolicyUri;
SessionId = sessionId;
SessionName = sessionName;
}
/// <summary>The endpoint URL of the connected server.</summary>
public string EndpointUrl { get; }
/// <summary>The server application name.</summary>
public string ServerName { get; }
/// <summary>The security mode in use (e.g., "None", "Sign", "SignAndEncrypt").</summary>
public string SecurityMode { get; }
/// <summary>The security policy URI (e.g., "http://opcfoundation.org/UA/SecurityPolicy#None").</summary>
public string SecurityPolicyUri { get; }
/// <summary>The session identifier.</summary>
public string SessionId { get; }
/// <summary>The session name.</summary>
public string SessionName { get; }
}

View File

@@ -0,0 +1,66 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Settings for establishing an OPC UA client connection.
/// </summary>
public sealed class ConnectionSettings
{
/// <summary>
/// The primary OPC UA endpoint URL.
/// </summary>
public string EndpointUrl { get; set; } = string.Empty;
/// <summary>
/// Optional failover endpoint URLs for redundancy.
/// </summary>
public string[]? FailoverUrls { get; set; }
/// <summary>
/// Optional username for authentication.
/// </summary>
public string? Username { get; set; }
/// <summary>
/// Optional password for authentication.
/// </summary>
public string? Password { get; set; }
/// <summary>
/// Transport security mode. Defaults to <see cref="Models.SecurityMode.None" />.
/// </summary>
public SecurityMode SecurityMode { get; set; } = SecurityMode.None;
/// <summary>
/// Session timeout in seconds. Defaults to 60.
/// </summary>
public int SessionTimeoutSeconds { get; set; } = 60;
/// <summary>
/// Whether to automatically accept untrusted server certificates. Defaults to true.
/// </summary>
public bool AutoAcceptCertificates { get; set; } = true;
/// <summary>
/// Path to the certificate store. Defaults to a subdirectory under LocalApplicationData.
/// </summary>
public string CertificateStorePath { get; set; } = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"LmxOpcUaClient", "pki");
/// <summary>
/// Validates the settings and throws if any required values are missing or invalid.
/// </summary>
/// <exception cref="ArgumentException">Thrown when settings are invalid.</exception>
public void Validate()
{
if (string.IsNullOrWhiteSpace(EndpointUrl))
throw new ArgumentException("EndpointUrl must not be null or empty.", nameof(EndpointUrl));
if (SessionTimeoutSeconds <= 0)
throw new ArgumentException("SessionTimeoutSeconds must be greater than zero.",
nameof(SessionTimeoutSeconds));
if (SessionTimeoutSeconds > 3600)
throw new ArgumentException("SessionTimeoutSeconds must not exceed 3600.", nameof(SessionTimeoutSeconds));
}
}

View File

@@ -0,0 +1,19 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Represents the current state of the OPC UA client connection.
/// </summary>
public enum ConnectionState
{
/// <summary>Not connected to any server.</summary>
Disconnected,
/// <summary>Connection attempt is in progress.</summary>
Connecting,
/// <summary>Successfully connected to a server.</summary>
Connected,
/// <summary>Connection was lost and reconnection is in progress.</summary>
Reconnecting
}

View File

@@ -0,0 +1,23 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Event data raised when the client connection state changes.
/// </summary>
public sealed class ConnectionStateChangedEventArgs : EventArgs
{
public ConnectionStateChangedEventArgs(ConnectionState oldState, ConnectionState newState, string endpointUrl)
{
OldState = oldState;
NewState = newState;
EndpointUrl = endpointUrl;
}
/// <summary>The previous connection state.</summary>
public ConnectionState OldState { get; }
/// <summary>The new connection state.</summary>
public ConnectionState NewState { get; }
/// <summary>The endpoint URL associated with the state change.</summary>
public string EndpointUrl { get; }
}

View File

@@ -0,0 +1,21 @@
using Opc.Ua;
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Event data for a monitored data value change.
/// </summary>
public sealed class DataChangedEventArgs : EventArgs
{
public DataChangedEventArgs(string nodeId, DataValue value)
{
NodeId = nodeId;
Value = value;
}
/// <summary>The string representation of the node that changed.</summary>
public string NodeId { get; }
/// <summary>The new data value from the server.</summary>
public DataValue Value { get; }
}

View File

@@ -0,0 +1,27 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Redundancy information read from the server.
/// </summary>
public sealed class RedundancyInfo
{
public RedundancyInfo(string mode, byte serviceLevel, string[] serverUris, string applicationUri)
{
Mode = mode;
ServiceLevel = serviceLevel;
ServerUris = serverUris;
ApplicationUri = applicationUri;
}
/// <summary>The redundancy mode (e.g., "None", "Cold", "Warm", "Hot").</summary>
public string Mode { get; }
/// <summary>The server's current service level (0-255).</summary>
public byte ServiceLevel { get; }
/// <summary>URIs of all servers in the redundant set.</summary>
public string[] ServerUris { get; }
/// <summary>The application URI of the connected server.</summary>
public string ApplicationUri { get; }
}

View File

@@ -0,0 +1,16 @@
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
/// <summary>
/// Transport security mode for the OPC UA connection.
/// </summary>
public enum SecurityMode
{
/// <summary>No transport security.</summary>
None,
/// <summary>Messages are signed but not encrypted.</summary>
Sign,
/// <summary>Messages are signed and encrypted.</summary>
SignAndEncrypt
}