Technical note-OPC UA Discovery in QuickOPC: Difference between revisions
No edit summary |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Local discovery]] [[Category:Global discovery]] [[Category:OPC UA]] [[Category:OPC UA discovery]] [[Category:Technical note]] | [[Category:Local discovery]] [[Category:Global discovery]] [[Category:OPC UA]] [[Category:OPC UA discovery]] [[Category:Technical note]] | ||
This article summarizes the OPC UA discovery features available, and how they work internally. Currently, it describes the status as of QuickOPC | This article summarizes the OPC UA discovery features available, and how they work internally. Currently, it describes the status as of QuickOPC 2018.2. | ||
== Main methods and properties == | == Main methods and properties == | ||
Line 8: | Line 8: | ||
=== '''IEasyUAClient''' Extension methods === | === '''IEasyUAClient''' Extension methods === | ||
* <code>UAApplicationElementCollection DiscoverApplications(this IEasyUAClient client, string discoveryHost, UAApplicationTypes applicationTypes)</code>. Discovers available OPC-UA applications and returns information about them, using the specified discovery host, and filtering by specified application types. | * <code>UAApplicationElementCollection DiscoverApplications(this IEasyUAClient client, string discoveryHost, UAApplicationTypes applicationTypes)</code>. Discovers available OPC-UA applications and returns information about them, using the specified discovery host, and filtering by specified application types. | ||
* <code>UAApplicationElementCollection DiscoverServers(this IEasyUAClient client, string discoveryHost)</code>. Discovers available OPC-UA servers and returns information about them, using the specified discovery host. | |||
* <code>UAApplicationElementCollection DiscoverServersOnNetwork(this IEasyUAClient client, IEnumerable<string> serverCapabilityFilter, string discoveryHost)</code>, and its overloads providing default argument values. Discovers available OPC-UA servers on the network and returns information about them, using the specified discovery host, and specifying the capabilities that the servers must have. Note: mDNS, LDS-ME (FindServersOnNetwork). | |||
* <code>UAApplicationElementCollection FindApplications(this IEasyUAClient client, string[] discoveryUriStringArray, UAApplicationTypes applicationTypes)</code>. Discovers available OPC-UA applications and returns information about them, using the specified discovery URI strings and filtering by specified application types. | * <code>UAApplicationElementCollection FindApplications(this IEasyUAClient client, string[] discoveryUriStringArray, UAApplicationTypes applicationTypes)</code>. Discovers available OPC-UA applications and returns information about them, using the specified discovery URI strings and filtering by specified application types. | ||
* <code>UAApplicationElementCollection | * <code>UAApplicationElementCollection QueryServers(this IEasyUAClient client, UAEndpointDescriptor gdsEndpointDescriptor, UAQueryServersFilter queryServersFilter)</code>, and its overloads providing default argument values. Globally discovers OPC-UA servers that meet the specified filters and returns information about them, using the specified GDS endpoint. | ||
=== Properties and methods on the '''EasyUAClient''' object === | === Properties and methods on the '''EasyUAClient''' object === | ||
* Property <code>InstanceParameters.DiscoveryHost</code>. The name of the machine that runs the discovery server that will be used for discovery tasks. | * Property <code>InstanceParameters.DiscoveryHost</code>. The name of the machine that runs the discovery server that will be used for discovery tasks. | ||
* Property <code>InstanceParameters.GdsEndpointDescriptor</code>. The endpoint descriptor of the Global Discover Server (GDS) that will be used for performing the discovery. | |||
<br/> | |||
* Method <code>UAApplicationElementCollection DiscoverServers()</code>. Discovers available OPC-UA servers and returns information about them, using the default discovery host ("localhost", unless specifically modified by the developer). | * Method <code>UAApplicationElementCollection DiscoverServers()</code>. Discovers available OPC-UA servers and returns information about them, using the default discovery host ("localhost", unless specifically modified by the developer). | ||
* Method <code>UAApplicationElementCollection DiscoverServersOnNetwork(IEnumerable<string> serverCapabilityFilter)</code>, with overload providing default argument value. Discovers available OPC-UA servers on the network and returns information about them, using the default discovery host, and specifying the capabilities that the servers must have. | |||
* Method <code>UAApplicationElementCollection QueryServers(UAQueryServersFilter queryServersFilter)</code>, with overload providing default argument value. Globally discovers OPC-UA servers that meet the specified filters and returns information about them, using the default GDS endpoint. | |||
=== COM interface === | === COM interface === | ||
The ''' | The '''_EasyUAClient''' interface contains a projection of the '''DiscoverApplications''' method of the '''IEasyUAClient''', and projections of the '''DiscoverServers''', '''FindApplications''' and '''QueryServers''' extension methods. | ||
== Design considerations == | == Design considerations == | ||
Line 24: | Line 30: | ||
* The above goals were not achievable with one method being just an extension to the other - at least not without introducing some mandatory parameters (such as discovery URI template strings) to the IEasyUAClient interface, which is what we want to avoid. | * The above goals were not achievable with one method being just an extension to the other - at least not without introducing some mandatory parameters (such as discovery URI template strings) to the IEasyUAClient interface, which is what we want to avoid. | ||
The initial goal has been extended as more types of discovery queries have become available - e.g. for mDNS (FindServersOnNetwork), or OPC UA Global Discovery Server (GDS). | |||
== Functionality == | == Functionality == | ||
Line 34: | Line 40: | ||
# Continues with [[#Steps common for both discovery methods]]. | # Continues with [[#Steps common for both discovery methods]]. | ||
=== When the ''' | === When the '''UAApplicationDiscoveryQuery''' is used === | ||
# Determines and uses the effective discovery parameters ('''UADiscoveryParameters'''). | # Determines and uses the effective discovery parameters ('''UADiscoveryParameters'''). | ||
# Continues with [[#Steps common for both discovery methods]]. | # Continues with [[#Steps common for both discovery methods]]. | ||
Line 46: | Line 52: | ||
# Performs various checks on the returned application descriptions. | # Performs various checks on the returned application descriptions. | ||
# Converts the returned application descriptions to '''UAApplicationElementCollection'''. | # Converts the returned application descriptions to '''UAApplicationElementCollection'''. | ||
=== When the '''UANetworkDiscoveryQuery''' is used === | |||
{{Under construction|TBD}} | |||
=== When the '''UAGlobalDiscoveryQuery''' is used === | === When the '''UAGlobalDiscoveryQuery''' is used === |
Latest revision as of 10:18, 5 April 2018
This article summarizes the OPC UA discovery features available, and how they work internally. Currently, it describes the status as of QuickOPC 2018.2.
Main methods and properties
Methods on the IEasyUAClient interface
UAApplicationElementCollection DiscoverApplications(UADiscoveryQuery discoveryQuery)
. Discovers available OPC-UA applications and returns information about them, using the specified discovery query.
IEasyUAClient Extension methods
UAApplicationElementCollection DiscoverApplications(this IEasyUAClient client, string discoveryHost, UAApplicationTypes applicationTypes)
. Discovers available OPC-UA applications and returns information about them, using the specified discovery host, and filtering by specified application types.UAApplicationElementCollection DiscoverServers(this IEasyUAClient client, string discoveryHost)
. Discovers available OPC-UA servers and returns information about them, using the specified discovery host.UAApplicationElementCollection DiscoverServersOnNetwork(this IEasyUAClient client, IEnumerable<string> serverCapabilityFilter, string discoveryHost)
, and its overloads providing default argument values. Discovers available OPC-UA servers on the network and returns information about them, using the specified discovery host, and specifying the capabilities that the servers must have. Note: mDNS, LDS-ME (FindServersOnNetwork).UAApplicationElementCollection FindApplications(this IEasyUAClient client, string[] discoveryUriStringArray, UAApplicationTypes applicationTypes)
. Discovers available OPC-UA applications and returns information about them, using the specified discovery URI strings and filtering by specified application types.UAApplicationElementCollection QueryServers(this IEasyUAClient client, UAEndpointDescriptor gdsEndpointDescriptor, UAQueryServersFilter queryServersFilter)
, and its overloads providing default argument values. Globally discovers OPC-UA servers that meet the specified filters and returns information about them, using the specified GDS endpoint.
Properties and methods on the EasyUAClient object
- Property
InstanceParameters.DiscoveryHost
. The name of the machine that runs the discovery server that will be used for discovery tasks. - Property
InstanceParameters.GdsEndpointDescriptor
. The endpoint descriptor of the Global Discover Server (GDS) that will be used for performing the discovery.
- Method
UAApplicationElementCollection DiscoverServers()
. Discovers available OPC-UA servers and returns information about them, using the default discovery host ("localhost", unless specifically modified by the developer). - Method
UAApplicationElementCollection DiscoverServersOnNetwork(IEnumerable<string> serverCapabilityFilter)
, with overload providing default argument value. Discovers available OPC-UA servers on the network and returns information about them, using the default discovery host, and specifying the capabilities that the servers must have. - Method
UAApplicationElementCollection QueryServers(UAQueryServersFilter queryServersFilter)
, with overload providing default argument value. Globally discovers OPC-UA servers that meet the specified filters and returns information about them, using the default GDS endpoint.
COM interface
The _EasyUAClient interface contains a projection of the DiscoverApplications method of the IEasyUAClient, and projections of the DiscoverServers, FindApplications and QueryServers extension methods.
Design considerations
The design allows to provide for multiple types of discovery in an extensible way. The thinking behind having the current two types was roughly as follows:
- We wanted a method where the developer can pass in just the discovery host name, as it is the most common use case.
- On the other hand, we needed a way for the developer to be able to specify a discovery URI explicitly, for use cases where the LDS runs on an unusual port or uses an unusual protocol. While at this, we should not lose the built-in parallel ability, hence not just one, but multiple discovery URIs needed to be passed in.
- The above goals were not achievable with one method being just an extension to the other - at least not without introducing some mandatory parameters (such as discovery URI template strings) to the IEasyUAClient interface, which is what we want to avoid.
The initial goal has been extended as more types of discovery queries have become available - e.g. for mDNS (FindServersOnNetwork), or OPC UA Global Discovery Server (GDS).
Functionality
When the UALocalDiscoveryQuery is used
- Determines and uses the effective host parameters (UAHostParameters) and discovery parameters (UADiscoveryParameters).
- Creates a *virtual* host session to the discovery host (note that this involves no connection to the target at this time).
- Determines the discovery URI strings for a given host. This is based on the HostParameters.DiscoveryUriTemplateStrings setting.
- Continues with #Steps common for both discovery methods.
When the UAApplicationDiscoveryQuery is used
- Determines and uses the effective discovery parameters (UADiscoveryParameters).
- Continues with #Steps common for both discovery methods.
Steps common for both above types of discovery queries
- Depending on the UADiscoveryParameters.ParallelDiscovery setting, performs the following operations serially or in parallel, on each discovery URI string, until a first operation success.
- Creates a *virtual* discovery session to the discovery URI string (note that this involves no connection to the target at this time).
- Determines the SDK endpoint configuration, setting its operation timeout to be UADiscoveryParameters.DiscoveryTimeout.
- Creates SDK discovery client. This uses the given discovery URI string.
- Calls the OPC UA FindServers service, using the SDK discovery client.
- Performs various checks on the returned application descriptions.
- Converts the returned application descriptions to UAApplicationElementCollection.
When the UANetworkDiscoveryQuery is used
Under construction: TBD
When the UAGlobalDiscoveryQuery is used
Under construction: TBD
Parameters on the EasyUAClient
The UAHostParameters object
The UAHostParameters object contains:
- Property
StringSet DiscoveryUriTemplateStrings
. The URL templates of discovery endpoints that will be used for discovery tasks.
The UADiscoveryParameters object
The UADiscoveryParameters object contains:
- Property
bool CheckApplicationDescription
. Check the application description. - Property
int DiscoveryTimeout
. A maximum time a server discovery can take (in milliseconds). - Property
bool ParallelDiscovery
. When set to true, the server discovery will be attempted on configured discovery endpoints simultaneously.
See also
Server Discovery: http://wiki.opcfoundation.org/index.php/Server_Discovery
Global Discovery Server Demonstration: https://opcfoundation.org/wp-content/uploads/2014/08/13_GDS_Demonstration.pdf