Aller au contenu principal

Reverse Engineering (reverse)

The reverse command converts an existing NodeSet2.xml file back into the OPC UA Modeler YAML DSL. This is the entry point for teams migrating from hand-written NodeSet XML files, or for importing third-party companion specification nodesets to use as a starting point.

opcua-modeler reverse --input MyModel.NodeSet2.xml --output my-model.yaml

Why reverse-engineer?

ScenarioHow reverse helps
You have existing NodeSet2.xml files and want to adopt the YAML workflowConvert once, then maintain in YAML
You want to understand a companion specification (e.g., DI, Robotics)Inspect it as readable YAML
You need to customise a third-party NodeSetImport it, modify the YAML, regenerate

Basic usage

# Reverse a single NodeSet2.xml to YAML
opcua-modeler reverse --input MyModel.NodeSet2.xml

# Specify output filename explicitly
opcua-modeler reverse --input MyModel.NodeSet2.xml --output my-model.yaml

By default, the output file is named after the input file with a .model.yaml suffix.


What gets converted

The reverse command reconstructs:

  • objectTypes — all custom ObjectType definitions
  • variableTypes — all custom VariableType definitions
  • dataTypes — enumerations and structure types
  • referenceTypes — custom reference type definitions
  • interfaces — OPC UA interface types
  • instances — concrete object instances with placement references
  • stateMachines — finite state machine definitions
  • namespaces — imported namespace aliases (where known)
  • promotedToMandatory — optional members that were instantiated
  • Descriptions, display names, and engineering unit data
Fidelity

The reverse output is a good starting point but may require manual cleanup. Not all NodeSet2.xml constructs have a 1:1 YAML equivalent, and some legacy constructs (OPC UA 1.03 type dictionaries, BSD/XSD schemas) are deliberately omitted from the output.


Round-trip workflow

A common workflow is to reverse-engineer once and then use generate for all subsequent changes:

NodeSet2.xml ──reverse──► model.yaml ──generate──► NodeSet2.xml (regenerated)

edit here

After the initial reverse, commit the .model.yaml to version control and treat it as the single source of truth. The original XML can be archived.


Options

FlagShortDescription
--input-iInput NodeSet2.xml file (required)
--output-oOutput .model.yaml filename
--debug-dExtra debugging output