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

Help needed with CPS twinning #4

Open
sebavarghese opened this issue Mar 10, 2021 · 11 comments
Open

Help needed with CPS twinning #4

sebavarghese opened this issue Mar 10, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@sebavarghese
Copy link

sebavarghese commented Mar 10, 2021

Hi,

I am trying to use the cps twinning framework, with the example specification file (CandyFactory.aml). I am facing some issues with the instantiation of PLC node (as I am getting socket errors). I would like to get clarifications on a few questions as put below:

  1. Is it possible to run this framework without a physical twin running along? As of now, I am not using the state replication module. I have installed mininet-wifi and matiec and cloned to the cps twinning repository. When I run ‘make twinning’ and ‘twinning misc/specification/CandyFactory.aml’, the topology is built correctly. But when I try to run ‘show_tags PLC1’ or get/set tags, it throws a socket error as seen in the attached file.
    twinning

Note: I even tried using the code available as tag v0.0.2 (without state replication), still I face the same issues as mentioned above.
2. Also, I believe a physical twin must be run parallel with the framework in order to use state replication. Is this correct?

I would like to know whether I miss configuring anything else. Your help is much appreciated.

@MatthiasEckhart
Copy link
Member

Hi,

  1. Yes, you don't need a physical twin to run the framework. The state replication module is only needed to synchronize the digital twins with their physical counterparts. Note that the provided state replication code is tailored to a specific physical setup and should merely provide guidance on how to adapt the state replication method to your needs.

From the stack trace it seems that /tmp/cps-twinning/plc_socket is missing. Could you please post a snippet of your /tmp/cps-twinning.log?

  1. Yes, this is correct.

Note that the provided framework is just a proof of concept and has therefore serious limitations in terms of stability and functionality. However, I am currently developing a new version of CPS Twinning from scratch as part of the SecurityTwin project. The new version will be open source as well and published when reaching the first milestone.

@MatthiasEckhart MatthiasEckhart added the bug Something isn't working label Mar 10, 2021
@sebavarghese
Copy link
Author

Thank you for your response.

For some reason, cps-twinning.log is empty. I am not sure if this is because of the below-highlighted error. I will try again and provide you the logs.

twinning2

@MatthiasEckhart
Copy link
Member

After running make twinning, several files should have been created in /tmp/cps-twinning. Could you please also check this directory?

@sebavarghese
Copy link
Author

sebavarghese commented Mar 10, 2021

twinning3
On running make twinning, cps-twinning.log and cps-twinning-states.log are created. Both of which are empty.
On running twinning <.aml>, other files and folders get created as shown in capture.

@sebavarghese
Copy link
Author

Before hitting this issue, there was an error which read:
File "/home/seba/cps-twinning/env/lib/python2.7/site-packages/kafka/client_async.py", line 234, in init
self.config['api_version'] = self.check_version(timeout=check_timeout)
File "/home/seba/cps-twinning/env/lib/python2.7/site-packages/kafka/client_async.py", line 830, in check_version
raise Errors.NoBrokersAvailable()
kafka.errors.NoBrokersAvailable: NoBrokersAvailable

For this, I have commented out the Kafka lines in twins.py code. However, on uncommenting them, I see some logs in cps-twinning.log.

image

@MatthiasEckhart
Copy link
Member

Sorry, yes, you are correct after running twinning *.aml, some files in the /tmp/cps-twinning folder should have been created.

Probably, the easiest option would be to run Apache Kafka and adapt the IP address in the constants.py accordingly. The Kafka errors should then be gone, provided that your machine that runs CPS Twinning is able to reach your Kafka broker.

@sebavarghese
Copy link
Author

After running Apache Kafka and changing IP address, kafka errors are resolved.
image

But still, the main error exists.
cpstwinning> show_tags PLC1
Traceback (most recent call last):
File "run.py", line 27, in
net=net)
File "run.py", line 17, in init
CLI(self.net)
File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.2.1d1-py2.7.egg/mininet/wifi/cli.py", line 10, in init
CLI.init(self, mininet, stdin=sys.stdin, script=None)
File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.2.1d1-py2.7.egg/mininet/cli.py", line 68, in init
self.run()
File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.2.1d1-py2.7.egg/mininet/cli.py", line 103, in run
self.cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/home/seba/cps-twinning/cpstwinning/cli.py", line 64, in do_show_tags
output(node.show_tags())
File "/home/seba/cps-twinning/cpstwinning/twins.py", line 121, in show_tags
result = self.__send_message(ShowTagsMessage())
File "/home/seba/cps-twinning/cpstwinning/twins.py", line 65, in __send_message
self.__send(msg)
File "/home/seba/cps-twinning/cpstwinning/twins.py", line 61, in __send
self.__create_connection()
File "/home/seba/cps-twinning/cpstwinning/twins.py", line 58, in __create_connection
self.conn = Client(address)
File "/usr/lib/python2.7/multiprocessing/connection.py", line 169, in Client
c = SocketClient(address)
File "/usr/lib/python2.7/multiprocessing/connection.py", line 308, in SocketClient
s.connect(address)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 2] No such file or directory

@MatthiasEckhart
Copy link
Member

Okay, thanks for the update. Are you using the forked version of Mininet-WiFi?

@sebavarghese
Copy link
Author

Yes, I am using the forked version.

@MatthiasEckhart
Copy link
Member

Okay, good. This version of CPS Twinning is not being actively developed any longer, and I currently don't have a running setup on my machine. Probably, the fastest way to resolve this issue is to send me your VM. Would this be an option for you?

@1939552724
Copy link

Hello,when I run the command "show_tags PLC1", the program raises a error. On line 127 of the function “show_tags(self)” in "twins.py", the program raises a error like "KeyError: name". Could you help me solve this problem? Thank you!
show_tags-Keyerror

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants