diff options
Diffstat (limited to 'tests/simple_send_eth0_2s1r')
| -rw-r--r-- | tests/simple_send_eth0_2s1r/out | 7 | ||||
| -rw-r--r-- | tests/simple_send_eth0_2s1r/receiver.py | 13 | ||||
| -rw-r--r-- | tests/simple_send_eth0_2s1r/sender.py | 5 | ||||
| -rwxr-xr-x | tests/simple_send_eth0_2s1r/simulator.py | 17 |
4 files changed, 42 insertions, 0 deletions
diff --git a/tests/simple_send_eth0_2s1r/out b/tests/simple_send_eth0_2s1r/out new file mode 100644 index 0000000..4a5ebb8 --- /dev/null +++ b/tests/simple_send_eth0_2s1r/out @@ -0,0 +1,7 @@ +[t=0.000,src=n0] Send 1 bytes to n2 on eth0 +[t=0.000,src=n1] Send 1 bytes to n2 on eth0 +[t=2.000,src=n2] Receive 1 bytes on eth0 +[t=2.000,src=n2] Received: Hello World from 0! +[t=2.000,src=n2] Receive 1 bytes on eth0 +[t=2.000,src=n2] Received: Hello World from 1! +[t=2.000,src=esds] Simulation ends diff --git a/tests/simple_send_eth0_2s1r/receiver.py b/tests/simple_send_eth0_2s1r/receiver.py new file mode 100644 index 0000000..2f268fd --- /dev/null +++ b/tests/simple_send_eth0_2s1r/receiver.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +def execute(api): + ##### Simple receive from node 0 + code, data=api.receive("eth0") + msg="Received: "+data if code == 0 else "Receive failed code="+str(code) + api.log(msg) + + ##### Simple receive from node 1 + code, data=api.receive("eth0") + msg="Received: "+data if code == 0 else "Receive failed code="+str(code) + api.log(msg) + diff --git a/tests/simple_send_eth0_2s1r/sender.py b/tests/simple_send_eth0_2s1r/sender.py new file mode 100644 index 0000000..90daae5 --- /dev/null +++ b/tests/simple_send_eth0_2s1r/sender.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +def execute(api): + api.send("eth0","Hello World from {}!".format(api.node_id),1,2) + diff --git a/tests/simple_send_eth0_2s1r/simulator.py b/tests/simple_send_eth0_2s1r/simulator.py new file mode 100755 index 0000000..9faaf3d --- /dev/null +++ b/tests/simple_send_eth0_2s1r/simulator.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# Load ESDS +import sys +sys.path.append("../../") +import esds +import numpy as np + +B=np.full((3,3),8) +L=np.full((3,3),0) +s=esds.Simulator(B,L) + +s.create_node("sender") +s.create_node("sender") +s.create_node("receiver") + +s.run() |
