summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-09-10 10:06:17 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-09-10 10:06:17 +0200
commitf7a7af979d89d01928c252e75a57844f710ab928 (patch)
treeade6de9b0dc7e9f4ac33cc3d2d397a17feabcea4
parent54d88bce8f0ae07fb4672f66fe0fed3f0edb4fcc (diff)
Start implementating platform files
-rw-r--r--esds/helpers/platform.py10
-rw-r--r--example/platform.yaml19
-rwxr-xr-xexample/platform_test.py7
-rw-r--r--pyproject.toml1
-rw-r--r--setup.cfg4
5 files changed, 40 insertions, 1 deletions
diff --git a/esds/helpers/platform.py b/esds/helpers/platform.py
new file mode 100644
index 0000000..eee2139
--- /dev/null
+++ b/esds/helpers/platform.py
@@ -0,0 +1,10 @@
+
+import yaml
+
+class YAMLPlatformFile:
+
+ def __init__(self, file_path):
+ self.file_path=file_path
+ with open(file_path) as f:
+ self.platform = yaml.load(f, Loader=yaml.FullLoader)
+ print(self.platform) \ No newline at end of file
diff --git a/example/platform.yaml b/example/platform.yaml
new file mode 100644
index 0000000..b8aa794
--- /dev/null
+++ b/example/platform.yaml
@@ -0,0 +1,19 @@
+general:
+ breakpoints: []
+ breakpoints_every: 0
+ debug: off
+ interferences: on
+
+nodes:
+ count: 5
+ implementations:
+ - file.py
+
+interfaces:
+ wlan0:
+ wireless: yes
+ links:
+ - 0: 5-8 => 10MBps
+ eth0:
+ wireless: no
+ links: 5Mbps \ No newline at end of file
diff --git a/example/platform_test.py b/example/platform_test.py
new file mode 100755
index 0000000..ccc9a98
--- /dev/null
+++ b/example/platform_test.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+from esds.helpers.platform import YAMLPlatformFile
+
+
+
+simulator=YAMLPlatformFile("platform.yaml") \ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index e540da4..d8682e5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,7 @@
[project]
name = "esds"
dynamic = ["version"]
+dependencies = ["numpy","pyyaml"]
[build-system]
requires = ["setuptools"]
diff --git a/setup.cfg b/setup.cfg
index e9582df..b8545b8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -8,7 +8,9 @@ keywords = simulator, distributed systems, cyber-physical systems, network, wire
license = GNU LGPLv3
[options]
-install_requires = numpy
+install_requires =
+ numpy
+ pyyaml
packages=find:
[options.packages.find]