-
Notifications
You must be signed in to change notification settings - Fork 32
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
OPC UA: Local server on port 4840 as LDS and the others as clients #75
base: develop
Are you sure you want to change the base?
Conversation
@kumajaya just to be clear: with your change it would still be possible to operate an LDS that would find all 4diac FORTE instances with enabled OPC UA multicast discovery? |
Possibly I still don't fully understand the multicast interaction here, please just hold this PR for now. |
Good to know. I set the state of this PR to draft so that we know that it is not ready for merge yet. |
Initially I just want to make UaExpert to show FORTE's UA server in their server list properly but with this patch, the second FORTE instance (i.e.: with -c localhost:61500 -op 4841 switch) will make the first instance close because both act as LDS server. I have to understand this problem better. I curious how you guys interact with FORTE from IDE with OPC UA profile, haven't been able to get it work even with the latest milestone build. |
@azoitl Sir, now the local server really can act as LDS and another instance can register to it as client, all shown inside UAExpert's ServersOnNetwork list. |
@kumajaya I slept this over and I don't think 4diac FORTE should be an LDS. How I understood it was always that the LDS is in charge of managing list of local servers. 4diac FORTE should announce its presence to an LDS. For that we enabled in 4diac FORTE the local multicast announcement. Or did I missunderstand something here? |
@azoitl Sir, I want to understand how OPC UA server interact with LDS. I could be wrong but with the latest change here, now FORTE local server can utilize itself (which run on port 4840) or official OPC UA Local Discovery Server as LDS. I found a bug in the current implementation or I'm just too buggy to understand it 😄 |
@@ -299,6 +308,7 @@ void COPC_UA_Local_Handler::serverOnNetworkCallback(const UA_ServerOnNetwork *pa | |||
DEVLOG_DEBUG("[OPC UA LOCAL]: mDNS %s '%.*s' with url '%.*s'\n", paIsServerAnnounce ? "announce" : "remove", paServerOnNetwork->serverName.length, | |||
paServerOnNetwork->serverName.data, paServerOnNetwork->discoveryUrl.length, paServerOnNetwork->discoveryUrl.data); | |||
|
|||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After fixing registerWithLds, I found we don't need that function to register to LDS.
DEVLOG_INFO("[OPC UA LOCAL]: Registering with LDS '%.*s'\n", paDiscoveryUrl->length, paDiscoveryUrl->data); | ||
UA_StatusCode retVal = UA_Server_addPeriodicServerRegisterCallback(mUaServer, 0, reinterpret_cast<const char*>(discoveryUrlChar->data), 10 * 60 * 1000, 500, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a UA client, this UA_Server_addPeriodicServerRegisterCallback only make FORTE crash.
@azoitl Sir, I enable OPC UA local server on start and with "opc.tcp://localhost:4840" MGR_ID, now I can interact with FORTE from IDE via OPC UA 😆 |
Ah you wanted to test the new OPC UA deployment mechanism. This is currently not yet automatically enabled. For testing you need to change the device that is used in main on startup. We are working on a mechanism to select witch device to use from cmake. |
Yes, and you guys are great 👍 I just pushed a change that completely disable unneeded multicast codes with #if 0 .. #endif In my opinion, FORTE doesn't need to be a complete LDS but I don't know the initial multicast design target. With my latest change, all FORTE instance listed inside UAExpert's ServersOnNetwork by utilize LDS from main FORTE instance on port 4840 or OPC UA Local Discovery Server form OPC Foundation |
@kumajaya the Multicast part is for enabling the LDS ME extension. I know that this definitely worked once and was needed. Maybe this is a different use case then yours. |
I restored the design and now it doesn't crash when a LDS server announces "LDS" message. |
Hi, It's definitely not crashing anymore, which is good. I have two questions though:
forte is still registered to the lds anyway, so probably this is related to the fact that forte is somehow a lds too. Do you see this error too?
why do you need that? is that really the case? I removed the whole block and forte still appears as discovered un uaexpert. |
Yes, I also got the error. In my understanding, OPC Foundation UA LDS expects the client (forte) make a connection with a security certificate.
UAExpert ignore LDS on different port but 4840. |
I think the whole block is not needed. As Alois mentioned, I think forte shouldn't be a LDS server, or at least that was not the intention initially. How it works, is that you have one LDS server (or more, but let's stay with one for simplicity) and any opc ua server, forte in this case, would then register itself to this LDS server. When you use UaExpert later, you basically then ask the LDS server for the list of regular servers which were registered and you get the list. One problem is that you have to know the LDS server endpoint to register yourself. That's where multicast come into play. The LDS-ME server sends a multicast message announcing itself, which in this case forte receives it (and doesn't crash anymore, thanks again), takes the discovery endpoint from the message and then it regsiter itself and the process is the same. More info here So, knowing this, I would say forte is not suppose to be a LDS. It could be, yes, but in general doesn't go well with a normal architecture. One important thing: UaExpert doesn't show the LDS servers (https://forum.unified-automation.com/topic1987.html) So, basically I removed the block about "LDS" capability and i could see forte in uaExpert when the discovery server is runnning.
I would recommend to remove this line and the whole code block |
@cochicde Thank you for your review and explanations. I will recheck this later. |
No description provided.