Search and contents

The fixture kit: standing in for a plant before it is reachable

A Node's connectors read from the plant, and the plant is often not reachable while a config is being written: it is on another network, it is in production, or it is not built yet. Four small tools let an integrator work against a stand-in, and find out what the real thing offers when it is reachable. Two more make a stand-in sample when nothing has been captured, and set candidate mappings side by side, one command makes the OPC UA stand-in from the listing in a single step, and one serves a target system's REST routes from a file.

ToolWhat it doesPage
python -m engine.opcua_browse_cli Lists the nodes of an OPC UA server, with the ids a connector takes. opcua-browse.md
kindred-opcua-node-server (built from sidecar/node_server) Serves exactly the OPC UA nodes in a text file. opcua-node-server.md
python3 -m engine.stand_in_cli Lists a target's OPC UA nodes, writes the node file and a config that points at the stand-in, and serves it with the node server. opcua-stand-in-command.md
deployment/install_integrator_toolchain.sh Builds what the browse command, the node server and the connection check need: the build tools, open62541, kindred-opcua-sidecar and the node server. opcua-stand-in-command.md
python -m engine.mqtt_player_cli Publishes a captured file of MQTT messages to a broker. mqtt-player.md
python -m engine.db_row_player_cli Creates a stand-in target database and writes rows to it on cue. db-row-player.md
python3 -m engine.rest_stand_in_cli Serves the REST routes a file names as a stand-in for a target system's REST interface, changes a route's body on cue, and keeps what a Node reports to it. rest-stand-in.md
python -m engine.scenario_cli Makes a synthetic sample, message file and statement file from a scenario file, with faults and a seed. integration-shape-simulator.md
python -m engine.shape_comparison_cli Runs one sample through two or more candidate configs and sets what each makes side by side. integration-shape-simulator.md

Each has its own page, with the file formats, options and exit codes, and a test that runs every command the page shows. This page says how they fit together and what they do not do.

For the browse, stand-in, check and preview steps run in order, with their output, see config-against-a-stand-in.md.

For one command that does the listing and the stand-in together, see opcua-stand-in-command.md.

What is covered and what is not

The browse command is covered by the stability policy (public-api-stability.md): its exit codes and the names and meanings of its options. The node server, the stand-in command and the two players are test tooling and are not covered. Their options, file formats and exit codes may change in any release, and the pages say so. None of them is installed or provisioned on an appliance by the provisioning scripts: the node server is built where it is wanted (deployment/install_integrator_toolchain.sh builds it, with the sidecar the browse command needs, and is not run by provisioning), and the Python commands are part of the engine package that every checkout has. The REST stand-in is test tooling in the same way: its commands, routes file format and exit codes may change in any release, and it is not provisioned either.

How they fit together

  1. Find out what the plant offers. When its OPC UA server is reachable, run the browse command against a config that names it. The listing gives each node's id, class and data type.

  2. Write a node file from it. A browse line such as

    ns=2;s=Line1.Setpoint  Variable  Double  2:Setpoint
    

    becomes a node-file line: the id as it is, the type name in lower case (Double is double), an access mode, the browse name without its namespace, and a value:

    ns=2;s=Line1.Setpoint  double  rw  Setpoint  72.5
    

    The node server serves the types listed on its page; a node of another type has to be left out or given one of those. Ids in namespace 0 are the server's own and are not served.

    One command, python3 -m engine.stand_in_cli, does steps 1 to 3 together (opcua-stand-in-command.md): it reads the listing as data, writes the node file and a config that names the stand-in, and serves it.

  3. Serve it, and point the connector at it. Run kindred-opcua-node-server on the file and put opc.tcp://HOST:PORT in the config's endpoint. The same config then reads the stand-in now and the plant later, with the endpoint as its only difference.

  4. Give the MQTT side something to read. Capture the plant's messages with mosquitto_sub -F '%J', or write them by hand, and publish them with the player. Retained messages stay on the broker for a connector that starts later.

  5. Give a database log scan something to read. Create one of the stand-in table layouts in a database you provide with python -m engine.db_row_player_cli init, and play inserts and updates into it with play (db-row-player.md). Unlike the other tools, this one writes to a database, and refuses one it did not set up. The MES as a database log plays one invented order's life into one and shows what a MES Node makes of it.

  6. Check the config against the stand-in. python -m engine.offline_check_cli CONFIG node-types --connect (offline-check.md) tests each connector against its target, and runs the same way against the plant.

Limits

  • Neither server nor player is a plant. The node server speaks Security Policy None, anonymous, on every interface: run it on a machine and network you trust. It serves single values, directly under the Objects folder, so a browse of it shows one level (the test server under tests/live_targets has a hierarchy, and is a test fixture, not a tool). A config that depends on a server's folders, methods, history or security is not exercised by it.
  • The row player writes to a database. It creates tables and writes rows, only in a database it set up itself (it refuses one without its marker table) and on a private network. It is a stand-in for the layouts of a target's log, not for anyone's actual database.
  • The node server's startup check covers IPv4 only. A port held on IPv6 alone is not noticed, and the server still prints that it is listening. Check that the port is free yourself if it matters.
  • The node server wakes every 5 ms, whether or not anyone is connected. That is a small, constant load, and it is not a server to leave running on a busy machine.
  • The player publishes; it does not record. It plays what a file holds, at the pace you give it. The file format does not preclude Sparkplug B: a Sparkplug payload captured as bytes plays through payload_base64. The player does not decode or encode one, and nothing here builds a Sparkplug publisher.
  • Browse is a walk, not a snapshot, and it has limits of its own (paging that repeats the walk, Variables and Methods not opened, a folder of over 200 children holding a continuation point). They are on its page.

Release: v0.11.0