Implement LmxOpcUa server — all 6 phases complete
Full OPC UA server on .NET Framework 4.8 (x86) exposing AVEVA System Platform Galaxy tags via MXAccess. Mirrors Galaxy object hierarchy as OPC UA address space, translating contained-name browse paths to tag-name runtime references. Components implemented: - Configuration: AppConfiguration with 4 sections, validator - Domain: ConnectionState, Quality, Vtq, MxDataTypeMapper, error codes - MxAccess: StaComThread, MxAccessClient (partial classes), MxProxyAdapter using strongly-typed ArchestrA.MxAccess COM interop - Galaxy Repository: SQL queries (hierarchy, attributes, change detection), ChangeDetectionService with auto-rebuild on deploy - OPC UA Server: LmxNodeManager (CustomNodeManager2), LmxOpcUaServer, OpcUaServerHost with programmatic config, SecurityPolicy None - Status Dashboard: HTTP server with HTML/JSON/health endpoints - Integration: Full 14-step startup, graceful shutdown, component wiring 175 tests (174 unit + 1 integration), all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
123
tools/opcuacli-dotnet/README.md
Normal file
123
tools/opcuacli-dotnet/README.md
Normal file
@@ -0,0 +1,123 @@
|
||||
# OPC UA CLI Tool (.NET)
|
||||
|
||||
Command-line utility for testing OPC UA server functions. Built with the [OPC Foundation UA .NET Standard](https://github.com/OPCFoundation/UA-.NETStandard) client library and [CliFx](https://github.com/Tyrrrz/CliFx).
|
||||
|
||||
- **Runtime**: .NET 10
|
||||
- **OPC UA Client**: OPCFoundation.NetStandard.Opc.Ua.Client
|
||||
|
||||
## Build & Run
|
||||
|
||||
```bash
|
||||
cd tools/opcuacli-dotnet
|
||||
dotnet build
|
||||
dotnet run -- <command> [options]
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### connect
|
||||
|
||||
Test connection to an OPC UA server:
|
||||
|
||||
```
|
||||
dotnet run -- connect -u opc.tcp://localhost:4840
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-u` | OPC UA server endpoint URL (required) |
|
||||
|
||||
### read
|
||||
|
||||
Read a value from a node:
|
||||
|
||||
```
|
||||
dotnet run -- read -u opc.tcp://localhost:4840 -n "ns=2;s=MyNode"
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-u` | OPC UA server endpoint URL (required) |
|
||||
| `-n` | Node ID to read (required) |
|
||||
|
||||
### write
|
||||
|
||||
Write a value to a node (auto-detects the data type from the current value):
|
||||
|
||||
```
|
||||
dotnet run -- write -u opc.tcp://localhost:4840 -n "ns=2;s=MyNode" -v 42
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-u` | OPC UA server endpoint URL (required) |
|
||||
| `-n` | Node ID to write to (required) |
|
||||
| `-v` | Value to write (required) |
|
||||
|
||||
### subscribe
|
||||
|
||||
Monitor a node for value changes:
|
||||
|
||||
```
|
||||
dotnet run -- subscribe -u opc.tcp://localhost:4840 -n "ns=2;s=MyNode" -i 500
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-u` | OPC UA server endpoint URL (required) |
|
||||
| `-n` | Node ID to monitor (required) |
|
||||
| `-i` | Polling interval in milliseconds (default: 1000) |
|
||||
|
||||
### browse
|
||||
|
||||
Browse the OPC UA address space:
|
||||
|
||||
```bash
|
||||
# Browse top-level Objects folder
|
||||
dotnet run -- browse -u opc.tcp://localhost:4840
|
||||
|
||||
# Browse a specific node
|
||||
dotnet run -- browse -u opc.tcp://localhost:4840 -n "ns=2;s=MyFolder"
|
||||
|
||||
# Browse recursively (depth 3)
|
||||
dotnet run -- browse -u opc.tcp://localhost:4840 -r -d 3
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-u` | OPC UA server endpoint URL (required) |
|
||||
| `-n` | Node ID to browse (default: Objects folder) |
|
||||
| `-d` | Maximum browse depth (default: 1) |
|
||||
| `-r` | Browse recursively using `--depth` as max depth |
|
||||
|
||||
## Example: Testing the LmxOpcUa Server
|
||||
|
||||
```bash
|
||||
cd tools/opcuacli-dotnet
|
||||
|
||||
# Connect to the local OPC UA server
|
||||
dotnet run -- connect -u opc.tcp://localhost:4840
|
||||
|
||||
# Browse the address space
|
||||
dotnet run -- browse -u opc.tcp://localhost:4840 -r -d 3
|
||||
|
||||
# Read a tag value
|
||||
dotnet run -- read -u opc.tcp://localhost:4840 -n "ns=2;s=TestMachine_001.SomeAttribute"
|
||||
|
||||
# Subscribe to live updates
|
||||
dotnet run -- subscribe -u opc.tcp://localhost:4840 -n "ns=2;s=TestMachine_001.SomeAttribute" -i 500
|
||||
```
|
||||
|
||||
## Example: Testing with the OPC PLC Sample Server
|
||||
|
||||
```bash
|
||||
# Start the sample server (from another terminal)
|
||||
cd tools/opcsampleserver/publish
|
||||
dotnet opcplc.dll --pn=50000 --autoaccept --unsecuretransport
|
||||
|
||||
# Browse the sample server
|
||||
dotnet run -- browse -u opc.tcp://localhost:50000 -r -d 2
|
||||
|
||||
# Read a sample node
|
||||
dotnet run -- read -u opc.tcp://localhost:50000 -n "ns=2;s=SlowUInt1"
|
||||
```
|
||||
Reference in New Issue
Block a user