docs(grpc-data): A4 docs — feature negotiation, imported conditions end to end, method status table, limits, security, ScadaBridge impact
DataConnections.md: x-otopcua-data-features negotiation; condition forwarding (key secret, bits 64/128/256, AllowGalaxyServiceAck, methods + status codes, limits/defaults, troubleshooting); corrects the A2a 'deploy adds/removes arrive as deltas' claim (a deploy ends the stream). AlarmTracking.md: Imported conditions. ScriptedAlarms.md: known after the first completed evaluation; what forwards. security.md: imported-condition gate, per-caller method re-check, service principal, on_behalf_of, audit category. Evidence A4-docs.md: plan-vs-code disagreements, TODO markers for the A4 code merge, ScadaBridge consumer impact.
This commit is contained in:
@@ -786,6 +786,122 @@ directly via System Platform's `HistorizeToAveva` toggle on the
|
||||
alarm primitive — no involvement from OtOpcUa. This sidecar path is
|
||||
exclusively for non-Galaxy alarm producers.
|
||||
|
||||
## Imported conditions (gRPC data connections)
|
||||
|
||||
A consumer node can import another cluster's alarm conditions over a gRPC data connection. To do that, a
|
||||
`RemoteNamespaceMapping` needs `Subscribe` + `AlarmSubscribe` and the origin needs `DataConnections:ConditionKeySecret`. The
|
||||
wire contract, grants, limits and method failure table are in [Data connections](DataConnections.md#condition-forwarding-end-to-end-a1a3).
|
||||
This section is what an OPC UA client of the **consumer** sees. Code: `OpcUaServer/ProjectedConditionRegistry.cs`,
|
||||
`ProjectedEventDelivery.cs`, `ImportedConditionMethods.cs`, `Runtime/DataConnections/ProjectedConditionAccess*.cs`.
|
||||
|
||||
### Identity
|
||||
|
||||
| Field | Imported condition |
|
||||
|---|---|
|
||||
| Namespace | `https://zb.com/otopcua/mapped/conditions`, the node manager's fifth namespace, separate from `mapped/raw` and `mapped/uns`. Its ids are classified before `RealmOf`, so they never fall back to Raw/UNS path grants. |
|
||||
| `ConditionId` (NodeId) = `SourceNode` | opaque `s=c1.<base64url(JSON{ConnectionId, ConditionKey})>`. Children are `<id>/<browse path>` (instance-scoped, #629). **Never construct or parse it**: browse, or take it from an event. |
|
||||
| `SourceName` | `<local anchor subject of the primary placement's mapping>/<placement address relative to that mapping's remote root>`, e.g. `Plant/remote-a/Modbus/dev1/HR200` (Raw) or `assembly/remote-line-2/filler/HR200` (UNS). A display field, not identity. The local rule "SourceName = ConditionId identifier" does **not** hold here. |
|
||||
| `ConditionName`, `Message`, `Comment`, `ClientUserId`, `ConditionClass`, `Quality` | from the origin's record |
|
||||
| `Severity` | verbatim from the origin (Part 9, 1..1000, clamped the same way as local conditions) |
|
||||
| Type | `OffNormalAlarm`, `DiscreteAlarm` or `AlarmCondition`, from the origin's condition type |
|
||||
|
||||
- **`ConditionId` is stable for the life of the connection.** It depends only on the connection id and the origin's
|
||||
`condition_key`, which comes from the origin cluster, the realm and the origin ConditionId under the cluster's secret.
|
||||
- Mapping changes do **not** move it. This covers adding a second mapping that sees the same condition, and disabling
|
||||
the primary-placement mapping. Only the notifiers and `SourceName` move.
|
||||
- Both consumer pair members show the same id, whatever principal each authenticates as.
|
||||
- What **does** change it:
|
||||
- rotating the origin's `ConditionKeySecret`;
|
||||
- the two origin pair members holding different secrets;
|
||||
- re-creating the connection under a new id.
|
||||
- One origin condition seen through several mappings or placements (a native alarm under a Raw mapping and two equipment
|
||||
references) is **one** consumer condition with several placements.
|
||||
- **Primary placement** (chooses `SourceName`) comes from deployed config only: Raw mappings before UNS, then mapping id
|
||||
ordinal, then placement address ordinal. It never depends on stream order.
|
||||
|
||||
### Notifiers and delivery
|
||||
|
||||
- Each placement's folder is wired as a notifier when it is materialised: a projected folder, or the mapping anchor.
|
||||
Wiring is lazy, in both directions, and also adds a root notifier. It is unwired at every projected-removal site.
|
||||
Projected folders of a condition-bearing mapping have `SubscribeToEvents` from materialisation. A client can therefore
|
||||
subscribe at a folder before any condition is wired there, and that subscription opens demand.
|
||||
- **One event per origin transition.** It is delivered to every wired folder item and to the Server object (`i=2253`),
|
||||
however many placements the condition has (one `ReportEvent`, through the shared report walk).
|
||||
- A folder holding an admitted event item is pinned: projection eviction and paging skip it. Removing the mapping still
|
||||
removes it.
|
||||
- Every imported event takes the gated, marked delivery path, and the gate is re-checked at publish (see
|
||||
[security](security.md#imported-conditions-over-data-connections)). An imported condition never re-enters the
|
||||
consumer's own condition-state hub, so it cannot be re-exported.
|
||||
|
||||
### ConditionRefresh and RefreshRequired
|
||||
|
||||
- `ConditionRefresh` replays imported conditions once each, through the gated path, ACLs on or off. The replay runs 128
|
||||
conditions per `Lock` hold. Imported conditions are excluded from the local replay paths.
|
||||
- `RefreshRequiredEventType` (`SourceName = "Server"`) is queued, off `Lock`, only to the items that may see an affected
|
||||
condition. It is sent when:
|
||||
- a snapshot barrier is incomplete (a mapping timed out, was refused or its metadata failed);
|
||||
- an imported condition is removed (a complete re-snapshot no longer lists it, a `removed` record, a capacity
|
||||
eviction, or a secret rotation). Removal emits **no** `NodeDeleted` model change;
|
||||
- a resync leaves retained EventIds un-re-bindable (see EventIds below).
|
||||
- **Before the first barrier, a refresh returns nothing imported**, because nothing is materialised yet. Conditions appear
|
||||
as their records apply. A RefreshRequired follows only if that barrier is incomplete; a refresh that merely preceded a
|
||||
complete barrier gets none (plan-vs-code note: A07, see `docs/plans/evidence/grpc-data-ext/A4-docs.md`).
|
||||
- A resync of unchanged state reports no event (#656 delta gate).
|
||||
- Clients **must** handle `RefreshRequiredEventType` by calling ConditionRefresh.
|
||||
|
||||
### EventIds and re-binding
|
||||
|
||||
- The consumer mints its own EventId for each imported event. It keeps the last **8** per condition, each bound to the
|
||||
origin activation marker of the record it was reported with.
|
||||
- Acknowledge, AddComment and Confirm accept only an EventId this consumer minted for that condition under the **current**
|
||||
marker. Anything else is `BadEventIdUnknown`, unsent.
|
||||
- The marker is bumped only for a new occurrence: an Active false→true edge, or any Acked true→false edge. A state-only
|
||||
record, a severity or message update, or a re-assert invalidates nothing.
|
||||
- **Origin failover or restart:** the new incarnation is a new marker.
|
||||
- The retained EventIds are re-bound, and stay ackable, only when the resynced record's state is unchanged **and** its
|
||||
`time` equals the time they were bound under.
|
||||
- Otherwise a fresh EventId is stamped (a ConditionRefresh returns it), the condition's watchers get `RefreshRequired`,
|
||||
and a pre-failover EventId answers `BadEventIdUnknown`.
|
||||
- A clear-and-re-raise during the gap never re-binds.
|
||||
- A consumer stream reset against the **same** origin incarnation keeps the old EventIds ackable.
|
||||
|
||||
### State, staleness and `state_known`
|
||||
|
||||
- **T2 invariant:** the consumer never retires or clears an alarm that is active at the origin.
|
||||
- A record with `state_known = false` changes nothing.
|
||||
- A condition first seen unknown is `Quality = UncertainInitialValue` until a known record arrives.
|
||||
- A stream end is a re-snapshot, never a removal. After `ConditionStaleTimeoutMilliseconds` each condition gets
|
||||
`Quality = BadNoCommunication` (one event, Active/Acked unchanged).
|
||||
- When an origin condition becomes known: scripted conditions, see
|
||||
[ScriptedAlarms § Forwarding over a data connection](ScriptedAlarms.md#forwarding-over-a-data-connection). Native
|
||||
conditions become known on the driver's standing-alarms signal; see DataConnections "Known state".
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Native (driver) condition | Scripted condition |
|
||||
|---|---|---|
|
||||
| Acknowledge | forwarded (Galaxy only with the export's `AllowGalaxyServiceAck`) | forwarded |
|
||||
| AddComment | forwarded (same Galaxy rule) | forwarded |
|
||||
| Confirm | **`BadNotSupported`**, unsent | forwarded |
|
||||
| Shelve / Unshelve / TimedShelve / Enable / Disable | `BadNotSupported`, unsent | `BadNotSupported`, unsent |
|
||||
|
||||
- Nothing is applied locally: the SDK handlers on an imported node refuse, and the node changes only when the origin's
|
||||
record arrives.
|
||||
- The native `ConfirmedState = true` rule is the origin's. A native ack at the origin re-asserts Confirmed, and the record
|
||||
the consumer applies carries it. The consumer's imported native conditions start Confirmed, as local ones do.
|
||||
- Each call is re-authorized for the **local** caller (the caller's `AlarmAcknowledge` / `AlarmConfirm` on the placement
|
||||
folder scope, and the mapping's bit).
|
||||
- Status codes, budgets and the "OutcomeUnknown" answers are in
|
||||
[Data connections § Condition methods](DataConnections.md#condition-methods-callconditionmethod).
|
||||
|
||||
### What the consumer does not do with imported conditions
|
||||
|
||||
- **No `alerts` topic publication.** So no `/alerts` rows and no consumer alarm history (AVEVA or SQL): imported conditions
|
||||
are not in `_alarmConditions` and the condition-state sink never sees them. The origin historizes its own transitions.
|
||||
- Not fed to `NativeAlarmProjector`; no local shelving timers.
|
||||
- Not HistoryRead-able, not writable. Imported condition ids refuse HistoryRead, Write and the alarm operations other than
|
||||
the three forwarded methods.
|
||||
|
||||
## Cross-references
|
||||
|
||||
- Plan: [docs/plans/alarms-over-gateway.md](plans/alarms-over-gateway.md)
|
||||
@@ -793,3 +909,4 @@ exclusively for non-Galaxy alarm producers.
|
||||
- Galaxy driver: [docs/drivers/Galaxy.md](drivers/Galaxy.md)
|
||||
- Phase 7 scripting + alarming: [docs/v2/implementation/phase-7-scripting-and-alarming.md](v2/implementation/phase-7-scripting-and-alarming.md)
|
||||
- Security + ACL: [docs/security.md](security.md)
|
||||
- Imported conditions over data connections: [docs/DataConnections.md](DataConnections.md)
|
||||
|
||||
Reference in New Issue
Block a user