opcua icon indicating copy to clipboard operation
opcua copied to clipboard

Issues to list nodes

Open thiagoftsm opened this issue 2 years ago • 0 comments

Hello guys,

At Netdata I began to write a new collector using your library, but I found an issue when I began to test your library with this Microsoft PLC.

The environment

  • Docker version
bash-5.1# docker version
Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:40:57 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:46:12 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • Docker image
bash-5.1# docker image ls
REPOSITORY                                 TAG       IMAGE ID       CREATED         SIZE
mcr.microsoft.com/iot/opc-ua-test-server   latest    62f273d9fd5f   3 months ago    112MB

I ran PLC with the following arguments:

docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --ctb --scn --lid --lsn --ref --gn=5 --ut --aa --to

Tests

And when I ran browser I observed this:

bash-5.1$ go run examples/browse/browse.go -endpoint opc.tcp://localhost:50000
debug: uacp: connecting to opc.tcp://localhost:50000
debug: uacp 1: start HEL/ACK handshake
debug: uacp 1: sent HELF with 57 bytes
debug: uacp 1: recv ACKF with 28 bytes
debug: uacp 1: recv &uacp.Acknowledge{Version:0x0, ReceiveBufSize:0xffff, SendBufSize:0xffff, MaxMessageSize:0x400000, MaxChunkCount:0x41}
debug: uasc 1/1: send *ua.OpenSecureChannelRequest with 132 bytes
debug: uacp 1: recv OPNF with 135 bytes
debug: uasc 1/1: recv OPNF with 135 bytes
debug: uasc 1/1: recv *ua.OpenSecureChannelResponse
debug: uasc 1/1: sending *ua.OpenSecureChannelResponse to handler
debug: uasc 1: received security token. channelID=2 tokenID=1 createdAt=2022-09-20T13:16:56Z lifetime=1h0m0s
debug: uasc 1/2: send *ua.CreateSessionRequest with 264 bytes
debug: uasc 1: security token expires at 2022-09-20T14:31:56Z. channelID=2 tokenID=1
debug: uasc 1: security token is refreshed at 2022-09-20T14:01:56Z (45m0s). channelID=2 tokenID=1
debug: uacp 1: recv MSGF with 10311 bytes
debug: uasc 1/2: recv MSGF with 10311 bytes
debug: uasc 1/2: recv *ua.CreateSessionResponse
debug: uasc 1/2: sending *ua.CreateSessionResponse to handler
debug: uasc 1/3: send *ua.ActivateSessionRequest with 142 bytes
debug: uacp 1: recv MSGF with 96 bytes
debug: uasc 1/3: recv MSGF with 96 bytes
debug: uasc 1/3: recv *ua.ActivateSessionResponse
debug: uasc 1/3: sending *ua.ActivateSessionResponse to handler
debug: client: monitor: start
debug: sub: pause
debug: uasc 1/4: send *ua.ReadRequest with 131 bytes
debug: uacp 1: recv MSGF with 353 bytes
debug: uasc 1/4: recv MSGF with 353 bytes
debug: uasc 1/4: recv *ua.ReadResponse
debug: uasc 1/4: sending *ua.ReadResponse to handler
debug: uasc 1/5: send *ua.ReadRequest with 190 bytes
debug: uacp 1: recv MSGF with 85 bytes
debug: uasc 1/5: recv MSGF with 85 bytes
debug: uasc 1/5: recv *ua.ReadResponse
debug: uasc 1/5: sending *ua.ReadResponse to handler
The node id refers to a node that does not exist in the server address space. StatusBadNodeIDUnknown (0x80340000)
exit status 1

and PLC reported:

[13:16:56 ERR] OPC: TCPSERVERCHANNEL ForceChannelFault Socket=00F47178, ChannelId=2, TokenId=1, Reason=BadConnectionClosed 'Remote side closed connection'
[13:16:56 ERR] OPC: 09/20/2022 13:16:56.201 TCPSERVERCHANNEL ForceChannelFault Socket=00F47178, ChannelId=2, TokenId=1, Reason=BadConnectionClosed 'Remote side closed connection'

After this I tried to use read/read.go and I observed this:

bash-5.1$ go run examples/read/read.go -endpoint opc.tcp://localhost:50000 -node 'ns=0;i=84'
debug: uacp: connecting to opc.tcp://localhost:50000
debug: uacp 1: start HEL/ACK handshake
debug: uacp 1: sent HELF with 57 bytes
debug: uacp 1: recv ACKF with 28 bytes
debug: uacp 1: recv &uacp.Acknowledge{Version:0x0, ReceiveBufSize:0xffff, SendBufSize:0xffff, MaxMessageSize:0x400000, MaxChunkCount:0x41}
debug: uasc 1/1: send *ua.OpenSecureChannelRequest with 132 bytes
debug: uacp 1: recv OPNF with 135 bytes
debug: uasc 1/1: recv OPNF with 135 bytes
debug: uasc 1/1: recv *ua.OpenSecureChannelResponse
debug: uasc 1/1: sending *ua.OpenSecureChannelResponse to handler
debug: uasc 1: received security token. channelID=4 tokenID=1 createdAt=2022-09-20T13:18:22Z lifetime=1h0m0s
debug: uasc 1/2: send *ua.CreateSessionRequest with 264 bytes
debug: uasc 1: security token is refreshed at 2022-09-20T14:03:22Z (45m0s). channelID=4 tokenID=1
debug: uasc 1: security token expires at 2022-09-20T14:33:22Z. channelID=4 tokenID=1
debug: uacp 1: recv MSGF with 10311 bytes
debug: uasc 1/2: recv MSGF with 10311 bytes
debug: uasc 1/2: recv *ua.CreateSessionResponse
debug: uasc 1/2: sending *ua.CreateSessionResponse to handler
debug: uasc 1/3: send *ua.ActivateSessionRequest with 142 bytes
debug: uacp 1: recv MSGF with 96 bytes
debug: uasc 1/3: recv MSGF with 96 bytes
debug: uasc 1/3: recv *ua.ActivateSessionResponse
debug: uasc 1/3: sending *ua.ActivateSessionResponse to handler
debug: client: monitor: start
debug: sub: pause
debug: uasc 1/4: send *ua.ReadRequest with 131 bytes
debug: uacp 1: recv MSGF with 353 bytes
debug: uasc 1/4: recv MSGF with 353 bytes
debug: uasc 1/4: recv *ua.ReadResponse
debug: uasc 1/4: sending *ua.ReadResponse to handler
debug: uasc 1/5: send *ua.ReadRequest with 126 bytes
debug: uacp 1: recv MSGF with 73 bytes
debug: uasc 1/5: recv MSGF with 73 bytes
debug: uasc 1/5: recv *ua.ReadResponse
debug: uasc 1/5: sending *ua.ReadResponse to handler
Status not OK: The attribute is not supported for the specified Node. StatusBadAttributeIDInvalid (0x80350000)

On PLC side I had an analogous report.

On the other hand, when I used this python library I got with success the output.txt I was expecting. I got this successful result with this python script.

Any other additional information that you need, please, let me know.

thiagoftsm avatar Sep 20 '22 13:09 thiagoftsm