From c2e6aad09f893e4c8cb5cb9243c32a0d6d0d1e12 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 9 Jun 2022 21:48:32 +0200 Subject: Init ESDS repository --- tests/simple_send_eth0_2s1r/out | 7 +++++++ tests/simple_send_eth0_2s1r/receiver.py | 13 +++++++++++++ tests/simple_send_eth0_2s1r/sender.py | 5 +++++ tests/simple_send_eth0_2s1r/simulator.py | 17 +++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 tests/simple_send_eth0_2s1r/out create mode 100644 tests/simple_send_eth0_2s1r/receiver.py create mode 100644 tests/simple_send_eth0_2s1r/sender.py create mode 100755 tests/simple_send_eth0_2s1r/simulator.py (limited to 'tests/simple_send_eth0_2s1r') 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() -- cgit v1.2.3