Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateFromServer method returns an endpoint with a different port number even if a matching endpoint with the same port number exists #2921

Open
1 of 5 tasks
niveditha-sooda opened this issue Dec 30, 2024 · 0 comments

Comments

@niveditha-sooda
Copy link
Contributor

niveditha-sooda commented Dec 30, 2024

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

When trying to update server information to the configured endpoint using the UpdateFromServer method, it returns the first entry with the matching security settings.

For e.g. Let's assume the configured endpoint on the client is opc.tcp://hostname:234[None:None:Binary].

The server exposes 2 endpoints

  1. opc.tcp://hostname:123[None:None:Binary]
  2. opc.tcp://hostname:234[None:None:Binary]

In this case, on calling the UpdateFromServer on the configured endpoint entry, the endpoint configuration for the endpoint opc.tcp://hostname:123[None:None:Binary] is returned instead.

Expected Behavior

Since the configured endpoint is opc.tcp://hostname:234[None:None:Binary], the server configuration for the same should have been returned. This is expected because the endpoint with the exact same url and security setting is exposed on the server.

We want to setup the sample test server where there are two separate endpoints for anonymous and the other authentication settings. Reference Server is used as the test server and the port number-based restrictions are made in the code so that an appropriate message is sent(e.g. BadSecurityPolicyRejected) when trying to connect to the server using the restricted endpoint url. Although through UAExpert the message was displayed correctly for the restricted port, the bug was encountered when testing this scenario with our UA client as it was still able to connect to the server successfully even with the restricted port.
Our client uses the UpdateFromServer method to update the server configuration for the configured endpoint which returns the incorrect endpoint.

Steps To Reproduce

This bug can be reproduced using the Reference Server and the Datatypes Server sample OPC UA servers.
For the purpose of testing the scenario, we use the Reference Client.

  1. Configure 2 endpoints for the Reference Server e.g. opc.tcp://host:62541/Quickstarts/ReferenceServer and opc.tcp://host:62542/Quickstarts/ReferenceServer
    Run the server.
  2. In the Program.cs of the ConsoleReferenceClient project, configure the server endpoint as opc.tcp://host:62542/Quickstarts/ReferenceServer
  3. In ConnectAsync method in the UAClient.cs of the ConsoleReferenceClient project, add the code "endpoint.UpdateFromServer();".
  4. Run the Client and check the endpoint updated after this point. It shows opc.tcp://host:62541/Quickstarts/ReferenceServer instead of the endpoint that was requested.
    The method returns the first url (based on the port number).

Environment

- OS: Windows 11 Enterprise
- Environment: Visual Studio 2022 17.11.5
- Runtime: .NET 8.0
- Nuget Version: Source Code taken from branch UA-.NETStandard-1.05.04-final-release-fixes
- Component:Opc.Ua.Core
- Server: Reference Server
- Client: Reference Client

Anything else?

CodeSnippet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant