FreeOpcUa / opcua-asyncio

OPC UA library for python >= 3.7
GNU Lesser General Public License v3.0
1.12k stars 361 forks source link

Attributes of DataTypes are not correctly handled by an opcua server #488

Open thunderbug1 opened 3 years ago

thunderbug1 commented 3 years ago

I did tests with custom data structures with this example but when I open the server with the opcua-client and navigate to Root/Types/DataTypes/BaseDataType/Structure then it does not show the attributes of any of the types. Shouldn't there be a detailed definition of what is contained? I also double checked the behaviour with an opcua server on an S7 PLC and there the opcua-client does show attributes for the types, so it must be an issue either with the example or the library.

image

oroulet commented 3 years ago

try the opcua-asyncio server. if there is a big there I can fix it

thunderbug1 commented 3 years ago

oh, quick response :)

where is that server?

oroulet commented 3 years ago

https://github.com/FreeOpcUa/opcua-asyncio

oroulet commented 3 years ago

it replaces python-opcua

thunderbug1 commented 3 years ago

Doesn't the example use opcua-asyncio?

I ran the example server on my laptop and connected to it with the opcua-client.

Sry for my confusion.

swamper123 commented 3 years ago

I think you are in the wrong repo. This is the old- sync one. I will switch it to opcua-asyncio.

swamper123 commented 3 years ago

Have you tried another Client, like UaExpert to verify that this is a server problem?

thunderbug1 commented 3 years ago

So far I only tried the opcua-client-gui, not sure if I can try out UaExpert since I am on a linux machine here.

I was surprised that the gui didn't show any attributes for any of the structure types when connected to the example server. To check if this is a gui issue I connected to another example server running on the S7 PLC and there the gui does show attributes for all of the structure types, so I don't think it is a client issue.

thunderbug1 commented 3 years ago

oh, I just saw that UaExpert is also available for linux, I will try it out as well.

thunderbug1 commented 3 years ago

Ok I tested it with the UaExpert now, here two screenshots. Not sure if anything is wrong here but the PLC server sets a lot more attributes as far as I can see.

image

image

thunderbug1 commented 3 years ago

Does anybody have an idea what causes this problem?

AndreasHeine commented 3 years ago

how does the req/res look like in wireshark is the result empty or is something in it maybe wrong encoded?

thunderbug1 commented 3 years ago

I had a closer look with wireshark as you suggested and I think it is an encoding issue because all requests are successful but the UaExpert still shows an "Unexpected structure" error.

here a screenshot of the UaExpert image

and the relevant network packets: captured_filtered.zip

I'm not quite sure at what point the encoding has an issue, the OPC-UA standard is quite bloated and hard to read in that regard.

thunderbug1 commented 3 years ago

I did another test with an open6241 test server to see how the types are displayed there, here a screenshot:

image

There are no custom data types here but also for all predefined ones the DataTypeDefinition is "BadAttributeIdInvalid" .. so maybe it is just a very minor bug where instead of this error a freeopcua server gives an unexpected structure. Sadly, for some reason, I could not capture the packets of this connection, maybe because of the VPN.