seb711 / Profinet-Controller-Simu

This repository aims to simulate a Profinet-Controller. Based on a GSDML file the connection is established and cyclic messages are exchanged.
7 stars 2 forks source link

"NameError: name 'AlarmCRBlockReq' is not defined" #7

Open ChrisIdema opened 1 year ago

ChrisIdema commented 1 year ago

Hi. We are adding PROFINET functionality to one of our products. We use the P-Net stack from rt-labs.com. We have the pn_dev demo running on a raspberry pi. Basic DCP communication seems to work (we can request the station name using the python library pnio_dcp). We don't have a running PLC program yet so we are looking for some code to test basic IO. Now we are trying to use your project to set/get an IO, but we are having various run time errors. First we updated some parameters such as the mac addresses, ethernet interface and station name. Now we are having some issues. We use scapy version 2.4.5, but that one is missing 'AlarmCRBlockReq': NameError: name 'AlarmCRBlockReq' is not defined newer releases add 'AlarmCRBlockReq' but removed the profinet files 'pnio_rpc': NameError: name 'pnio_rpc' is not defined

seb711 commented 1 year ago

How did you install the scapy-library? Try building it with the latest GitHub-Code.

git clone https://github.com/secdev/scapy 
cd scapy
sudo python3 setup.py install
seb711 commented 1 year ago

Drop me a mail (sebastian@kosaks.de) if you cannot get it working. I also did some tests with the P-Net stack from rt-labs and have a simulation environment build up with MiniNet. Unfortunately I didn't published it because I didn't wanted to get in trouble with rt-labs. I can add you to the repository if you're interested! I'm sure i can help you out with your problem!

ChrisIdema commented 1 year ago

How did you install the scapy-library? Try building it with the latest GitHub-Code.

git clone https://github.com/secdev/scapy 
cd scapy
sudo python3 setup.py install

I used sudo pip install -v "scapy==2.4.5"

I'm going to try to github install.

EDIT: I get the same error with the latest scapy. I created my own fork of your repo if you want to check it out. I will send you an email.

seb711 commented 1 year ago

Invite me to your fork and I'll have a look!

ChrisIdema commented 1 year ago

We are having some problems with the port 49153. It seems we can send over that port but when the raspberry pi sends a message back it is not received by scapy. An ICMP message is send saying the port is unreachable. We added the port to the iptables filter, but to no avail: sudo iptables -A INPUT -p UDP --dport 49153 -j ACCEPT Profinet_Controller_Capture_filtered.zip