Skip to main content

Namespaces and imports

Use namespaces: and imports: to load the OPC UA NodeSet2.xml files that the gateway needs. These files define the types: companion specifications such as Device Integration (DI), and your own models. The instances: section can then make nodes from these types.

Words on this page​

WordMeaning
NodeSet2.xmlAn XML file that defines the types and the nodes of an OPC UA model.
companion specificationA standard model of the OPC Foundation, for example DI or Machinery.
namespace aliasThe short prefix of a namespace: di, t. A browse path uses it: di:DeviceSet.

How to load a companion specification​

  1. Find the alias in the list of namespace aliases.
  2. Add the alias to namespaces:.

The gateway includes these NodeSet2.xml files. The gateway adds the dependencies of each one and loads them in the correct order. If you list adi, the gateway loads di first. The standard namespace ua is always loaded. Do not list it.

How to load your own NodeSet2.xml file​

  1. Put the file in the folder of the configuration file, or in a folder below it.
  2. Add an entry to imports:.
  3. Set alias: to the short name that browse paths use for the model.
  4. Set filename: to the path of the file, relative to the configuration file.
  5. Set uri: to the namespace URI that the file declares.

The gateway needs alias: and at least one of uri: and filename:. If you set both, the gateway checks that the file it loads has this uri:.

A complete example​

namespaces:
- di
- machinery

imports:
- alias: t
uri: http://sterfive.com/UA/MyAnalyserDevice/
filename: ./model/MyAnalyserDevice.Nodeset2.xml

A browse path refers to the nodes of these models with the alias: di:DeviceSet, t:AnalyserDeviceType. The instances section can make instances of their types.

Keys of an imports: entry​

KeyRequiredMeaning
aliasRequiredThe short name that browse paths use for the model.
uriOne of uri and filenameThe namespace URI that the NodeSet2.xml file declares.
filenameOne of uri and filenameThe NodeSet2.xml file, relative to the folder of the configuration file.
publicationDateOptionalThe gateway requires a NodeSet2.xml file published on this date or later.
sha256OptionalThe sha256 hash that the file must have.

The key reference is in namespaces and imports.

Notes​

  • The gateway loads the NodeSet2.xml files when it builds the address space. A change takes effect when the gateway loads the configuration again or restarts.
  • The nodes that instances: makes are in namespace 1. Its alias is own: own:DistanceSensor.
  • A modelling tool, for example the OPC UA Modeler, makes, documents and versions NodeSet2.xml files.

How to convert a configuration file of version 3​

Version 3 used one key, nodesets:, with nodeset2: for the file:

# Version 3: the current gateway refuses this form.
nodesets:
- di
- alias: t
nodeset2: ./model/MyAnalyserDevice.Nodeset2.xml

The current gateway refuses this form and shows a message that says so.

  1. Run opcua-omni-edge migrate-config config.yaml. The command changes the file in place.
  2. To see the result without a change to the file, add --dry-run.
opcua-omni-edge migrate-config config.yaml