Search code examples
opc-uamilo

Eclipse Milo: How to use the Discovery Feature of OPC UA?


I have some questions about the discovery feature of OPC UA:

  1. How do I register a OPC UA-server on a discovery-server? Is this only possible, if the manufacturer provides something like a web interface for that, or is there a standardized way to do it?
  2. How do I register a OPC UA-server, which is created with milo, on a discovery-server?
  3. Is it possible to disable the discovery-server which is automatically started with a milo opc ua-server?
  4. How to get informations about the registered servers with milo?

Solution

    1. How do I register a OPC UA-server on a discovery-server? Is this only possible, if the manufacturer provides something like a web interface for that, or is there a standardized way to do it?

    The manufacturer needs to support the discovery profile. The OPC UA Specification Part 11 (freely avalable after registration: https://opcfoundation.org/developer-tools/specifications-unified-architecture/) describes this in more detail.

    There are three main concepts for OPC UA Discovery:

    • Local Discovery Server (LDS):
      A client needs to know the IP address of the LDS server and then calls the RegisterServer or RegisterServer2 Service via OPC UA.

    • Local Discovery Server with Multicast Extension (LDS-ME):
      Server and client use standardized mDNS multicast queries to find other OPC UA instances in the network. As soon as an LDS-ME server announces itself, a normal OPC UA server knows the IP address and it calls RegisterServer or RegisterServer2

    • Global Discovery Server (GDS):
      For large systems there may be multiple subnets where multicast queries do not work. A GDS is an enterprise wide discovery server which also supports certificate management.

    1. How do I register a OPC UA-server, which is created with milo, on a discovery-server?

    Eclipse Milo does not fully support the discovery features. It basically supports LDS. There is currently an open PR by myself, but unfortunately it is not merged yet: https://github.com/eclipse/milo/pull/89

    1. Is it possible to disable the discovery-server which is automatically started with a milo opc ua-server?

    Since Eclipse Milo does not support discovery services by default, it is not automatically started. Anyways you can define, which services are supported by adding or removing the corresponding service set. Check out this line:

    stackServer.addServiceSet((DiscoveryServiceSet) sessionManager);
    

    https://github.com/eclipse/milo/pull/89/files#diff-6eb416ef6889e36b34b34e32cb78b823R122

    1. How to get informations about the registered servers with milo?

    After another server registered itself via RegisterServer or RegisterServer2 a client can retrieve the list of registered servers via two service calls.

    • FindServers returns the list of registered servers, which called RegisterServer or RegisterServer2
    • FindServersOnNetwork is only supported for LDS-ME servers and additionally returns the servers which announced themselves via an mDNS message but did not yet register.

    If you are looking for an open source stack which fully implements the LDS and LDS-ME features, you can have a look at the open62541 project, which is a C/C++ implementation of OPC UA: https://github.com/open62541/open62541

    The GDS feature is currently under development for the open62541 stack. (Disclaimer: I'm one of the core devs at open62541)

    Additional ressources:

    You can also check out a paper I wrote about the OPC UA LDS-ME Discovery feature and a specific use-case titled OPC UA for Plug & Produce: Automatic Device Discovery using LDS-ME (https://mediatum.ub.tum.de/node?id=1375255)