Skip to content

OPC UA probe

The OPC UA probe opens a session with an OPC UA server and runs one or several steps on it, recording every service call with its request and its response. VirtuProbe speaks OPC UA directly, written against the specification rather than wrapped around a client library, so you can send a request a client library would refuse and you see what the server did with it, including the things it did that the specification does not allow.

A probe is an endpoint, a security policy, an identity and a list of steps. One send opens the channel, creates and activates the session, runs the steps in order and closes the session again.

The OPC UA probe editor: a session to opc.tcp://localhost:4840/virtuprobe with security policy None and anonymous identity, the Write arm switch set to read-only and a single Browse step on the node ns=2;s=Plant.

FieldDescription
Endpoint URLThe address of the server. Its scheme picks the transport
Timeout (ms)How long one service call may take (default: 10000)
Trust any TLS certificateAccept a TLS certificate that does not verify. Shown for opc.wss and opc.https. Lab use

Three transports carry the same binary encoding:

SchemeTransport
opc.tcp://host:4840/pathOPC UA TCP, the usual one
opc.wss://host:443/pathThe same conversation inside a WebSocket over TLS
opc.https://host:443/pathOne HTTPS exchange per service call, with no secure channel of its own

Pick a Security policy and a Mode (Sign or Sign and encrypt). With a policy other than None, the probe first reads the server’s endpoint list without security to learn the server certificate, then opens the secure channel.

The policy set covers all 28 policies the OPC Foundation’s profile database names for clients and servers, which are None, the five RSA policies, the two RSA policies with Diffie-Hellman key agreement and the twenty elliptic curve policies on the NIST, Brainpool, curve25519 and curve448 curves. They are not all in the same standing, so beside each policy except None the list shows labels that say what stands behind it. The result of a send carries the same labels.

A new probe’s dropdown offers only the policies that are both released and witnessed. A policy implemented from the specification with no independent witness is documented here but not offered for a fresh pick. It shows in the list only on a saved probe that already names it.

LabelWhat it means
VerifiedRun against at least one independent OPC UA implementation
From the specification onlyImplemented from the specification. No independent implementation was available to check it against
DeprecatedThe OPC Foundation has deprecated the policy. Use it to test a server that still offers it
Not releasedThe OPC Foundation has not released the policy yet, so its definition may still change

Six policies carry From the specification only (ECC_curve25519 and ECC_curve448, each with AesGcm, ChaChaPoly and ChaCha20Poly1305). A pass under one of them tells you the server and VirtuProbe read the specification the same way. It is weaker evidence than a pass under a verified policy.

The two policies named plain ECC_curve25519 and ECC_curve448 are deprecated and verified against open62541. They show a Derive a signing key switch. The published profile says these two policies have no separate signing key and open62541 derives one anyway. If a server ends the connection with BadSecurityChecksFailed right after the channel opens, turn the switch on.

FieldDescription
Client certificateA client certificate credential (scheme MTLS, mutual TLS) from the credential store. Optional
Application URIThe URI the session names. Left empty, the one in the certificate is used

Both fields show only with a policy other than None.

You do not need a certificate to try a policy. With none chosen, each send makes a self-signed certificate of the key type the policy needs (RSA or the right curve) and the result says that it did. Choose a certificate credential when the server only trusts certificates it knows.

A server may refuse a session whose application URI is not the one in the certificate (BadCertificateUriInvalid), which is why the field follows the certificate when you leave it empty. Set a different value to see whether your server checks.

Log on asCredential
Anonymousnone
User name and passwordA Basic credential
User certificateA certificate credential. The session proves it holds the private key by signing the server’s nonce
Issued tokenA Basic credential whose password holds the token

Secret format decides how a password or a token is encrypted for the server. Automatic uses the legacy format up to 64 bytes and EncryptedSecret above that. Forcing one of the two shows which formats a server accepts.

Session name is the name the session gives the server (default: VirtuProbe). New credential makes a user name or a token credential without leaving the editor.

An anonymous probe stays anonymous: the project’s default credential is not applied to it. A probe that logs on and has no credential of its own uses the project default (see when the probe names its own account).

Switch between One action and Several steps. One action runs a single step on a session of its own. Several steps run in order on one session and a step that fails ends the run. The session is closed either way.

StepWhat it doesFields
Connect checkOpens the channel, creates the session, logs on and closes itnone
Get endpointsLists the server’s endpoints with the security each one offers. Needs no sessionnone
Find serversAsks the server which servers it knows. Needs no sessionnone
ReadReads one attribute of one or several nodesNode id, Attribute, Index range per node
WriteWrites a value to a nodeNode id, Attribute, Index range, Type, Value, JSON
BrowseFollows the references of a nodeNode id, Direction, Reference type, Include subtypes, At most
Translate pathFinds a node by its browse pathStart node, Browse path such as /Objects/2:Plant/2:Pump
Call methodCalls a method with typed argumentsObject, Method, one Type, value and JSON per argument
SubscribeWatches values or events and waits for notificationsnodes, Events, Wait for notifications, For at most (ms), Publishing interval (ms)
Read historyReads stored values of a node, the last hour when From and To are emptyNode id, From, To, Values
Any serviceSends any service of the specification by nameService, Request body (JSON)

A node id is written the way the specification writes it: i=2258, ns=2;s=Pump.Speed, ns=2;i=1001. Read takes the Value attribute unless you pick another, so the same step reads a node’s browse name, data type or access level.

A value is typed. Pick the Type (Double, Int32, String and the other built-in types) and write the value as text. For an array or a structure, tick JSON and write it as JSON, for example [1, 2, 3].

Subscribe creates a subscription and one monitored item per node, collects the number of notifications you ask for and deletes the subscription again. With Events on, it watches the node’s events and returns the event id, type, source name, time, message and severity of each one. A subscription that does not deliver the number you asked for in time is a failed step that still shows what did arrive.

A step fails when the server refuses the service or when any operation in it comes back with a bad status. A read of three nodes where one does not exist fails and still shows all three results.

Any service takes the name of a service (the list holds every service of the specification) and the request as a JSON object, with its fields named the way the specification names them:

{"NodesToRead": [{"NodeId": "i=2258", "AttributeId": 13}]}

The request header is filled in for you. A node id is its text, an enumeration is its name, a status code is its name and a Variant names its type ({"type": "Double", "value": 1.5}). This is VirtuProbe’s own plain form for showing and writing a request. The probe still sends the binary encoding. A field name the service does not have fails the step before that request is sent and the error names the field.

OPC UA servers run plants, so a probe that changes the target is sent only when writes are enabled for the workspace in Settings > Advanced, the probe is Armed for writes and you confirm the send. In a chain there is nobody to confirm, so the first two decide. A refused probe sends nothing at all and the result says which condition was missing.

A probe counts as changing the target when it contains a Write or a Call method step, or an Any service step naming Write, Call, HistoryUpdate, AddNodes, AddReferences, DeleteNodes, DeleteReferences, RegisterServer, RegisterServer2 or TransferSubscriptions. Activating a session under somebody else’s authentication token counts too. A service VirtuProbe does not know counts as a write, because nothing says it is a read.

A step that changes the target carries a Modifies target chip and the bar above the result lists the reasons. A subscription the probe makes for itself is a read: it lives in the probe’s own session and is deleted before the session closes.

The result names the security policy and mode with the policy’s labels, the session id and the server certificate. Below it, Service calls lists every call of the run in order, each with its status, its duration and the step it belongs to. A row expands to the results of the step, to the request and to the response as the server sent it.

The calls a session needs are in the list as well, namely GetEndpoints (under a security policy), OpenSecureChannel, CreateSession, ActivateSession and CloseSession.

An OPC UA response: the service calls of the run in order, OpenSecureChannel, CreateSession, ActivateSession, the Browse returning two references and CloseSession, each marked Good.

When a server does something the specification does not allow and the run can go on, the run goes on and the result lists it under What the server did against the specification, for example a sequence number out of line or bytes left over after a response.

A refusal is recorded with the server’s status. On the local asyncua server a wrong password fails the probe with ActivateSession was refused with BadUserAccessDenied. A node that does not exist shows BadNodeIdUnknown on that one result.

An expression may start with #N, the number of a step counted from one. Without it, the last step that produced results is meant.

ExtractorReturns
OPCUA_SUCCESStrue when every step ran and no operation came back with a bad status, otherwise false
OPCUA_VALUEThe value a step produced. Blank is the first result, a number is its position from 0, a node id picks that node
OPCUA_STATUS_CODEThe status of a result by name, such as BadNodeIdUnknown. The expression picks the result the same way
OPCUA_NODE_IDThe node id of a result, such as a browsed reference or the target of a translated path
OPCUA_RESULT_COUNTHow many results a step produced, counting values, references, notifications or endpoints
OPCUA_RESULTA dotted path into the results of a step, such as 0.event.Message.text or 0.outputArguments.0
OPCUA_RESPONSEA dotted path into the response of a service call as the server sent it, such as Results.0.StatusCode.name
OPCUA_SESSION_IDThe node id of the session the server created
OPCUA_TRANSPORT_OUTCOMEHow the conversation ended, such as OK, CONNECT_REFUSED, TIMEOUT, TLS_FAILED, REFUSED or BLOCKED
OPCUA_FINDING_COUNTHow many things the server did against the specification
OPCUA_ERRORWhy the probe failed, in words. Blank when it did not
OPCUA_WRITE_BLOCKEDWhy a probe that changes the target was not sent. Blank when it was

OPC UA is a chain step. {{variable}} placeholders resolve into the endpoint URL, the application URI, the session name, the security policy, the mode and every text in a step, including the JSON body of Any service, before the probe is sent. One pattern is to write a setpoint, read it back with OPCUA_VALUE and #2 and assert on the value. Another is HTTP then OPC UA: change something through the system’s own API, then read the node it is supposed to drive.

A probe that changes the target has to be armed to run in a chain. Unarmed, the chain step fails with OPCUA_WRITE_BLOCKED set and nothing is sent.

A mock rule for OPC UA names a service (Read, Browse, CreateSession) and answers it with either a status name such as BadUserAccessDenied or the response written as a JSON object. The service name is matched whole, so a rule for Browse does not answer BrowseNext.

Through the proxy, what can be read depends on how the channel is secured. Without security every message is decoded and a mock rule can answer a request that fits one chunk. In Sign mode the messages are decoded and cannot be answered, since an answer would need the server’s signature. In Sign and encrypt mode the proxy shows the message type, the channel and the size. opc.wss and opc.https are HTTP as far as the proxy is concerned.

virtuprobe-docker ships three OPC UA servers from three independent implementations, which do not behave the same.

Terminal window
cd virtuprobe-docker/all-protocols && docker compose up --build -d opcua opcua-open62541 opcua-dotnet

The first build compiles open62541 and takes a few minutes. The reference server lists no endpoints for about 25 seconds after its port opens.

ServerEndpointOffers
asyncuaopc.tcp://localhost:4840/virtuprobe (and 4841 with a 4096 bit key)None and five RSA policies. A pump with values, a method, history and events
open62541opc.tcp://localhost:4842None, five RSA and eight elliptic curve policies
The OPC Foundation reference serveropc.tcp://localhost:62541/Quickstarts/ReferenceServer, opc.https on 62540, opc.wss on 62543None and eleven policies, among them RSA with Diffie-Hellman and the Brainpool curves

On asyncua, operator may read, write and call methods and viewer may only read, both with the password Password123!. The pump lives in namespace 2 as ns=2;s=Pump.Speed, ns=2;s=Pump.Setpoint, ns=2;s=Pump.Counter (with history) and the method ns=2;s=Pump.Start. open62541 has the same two users, lets both write and keeps Pump.Speed and Pump.Setpoint in namespace 1. The reference server has the users user1 / password, user2 / password1 and sysadmin / demo.

What differs between the three:

  • A session whose application URI does not match the certificate is refused by open62541 and the reference server and accepted by asyncua.
  • open62541 leaves one byte after its OpenSecureChannel response under ECC_nistP256 in Sign mode. The probe passes and reports it.
  • asyncua refuses a reader’s write by refusing the whole Write service, so the status sits on the service call and there are no results. OPCUA_STATUS_CODE reads the status of a result when there is one and the status of the service call otherwise.
  • PubSub (OPC 10000-14) is a separate protocol family: messages over UDP, MQTT or AMQP with security policies of their own. This probe covers the client and server model of OPC UA, as a client.
  • The XML and JSON encodings. The probe speaks the binary encoding on all three transports.
  • Reverse connect, where the server opens the connection to the client.
  • A global discovery server. Find servers and, through Any service, FindServersOnNetwork can be sent to one. None of the three local servers is a discovery server, so the probe has not been run against one.

A probe file written by hand or over MCP is shaped like this.

  • The security policy field is securityPolicy. It takes the policy’s name (Basic256Sha256, ECC_nistP256). The mode field is securityMode with Sign or SignAndEncrypt.
  • A step is a type and a params object. {"type": "READ", "params": {"nodes": [{"nodeId": "i=2258"}]}} is the whole of a read.