aboutsummaryrefslogtreecommitdiff
path: root/examples/ouroboros-layer-example.py
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-03-01 11:02:25 +0100
committerDimitri Staessens <dimitri@ouroboros.rocks>2026-03-07 11:29:02 +0100
commit6cbcfb039e608419bd6ced673723918aca6fb278 (patch)
tree172061d95f50cda09c3872d32c5f77e459044cd8 /examples/ouroboros-layer-example.py
parent4e35c6b445d0cfbad9cf15a48f2d341e29dbd806 (diff)
downloadrumba-6cbcfb039e608419bd6ced673723918aca6fb278.tar.gz
rumba-6cbcfb039e608419bd6ced673723918aca6fb278.zip
rumba: Remove irati/rlite, python2 and qemu support
Remove IRATI and rlite prototype plugins, keeping only Ouroboros. Delete .gitlab-ci.yml (only contained an irati test job and a Sphinx pages job). Clean up all irati/rlite imports and references from examples, documentation, and tools. Qemu was tied heavily with rlite and irati. As it's less useful for ouroboros it's removed rather than reworked. Updated README.md and AUTHORS Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Diffstat (limited to 'examples/ouroboros-layer-example.py')
-rw-r--r--examples/ouroboros-layer-example.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/ouroboros-layer-example.py b/examples/ouroboros-layer-example.py
new file mode 100644
index 0000000..310a204
--- /dev/null
+++ b/examples/ouroboros-layer-example.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+"""
+Example using the Ouroboros-aligned layer-centric API.
+
+Shows the naming conventions: Layer, UnicastLayer, EthDixLayer, etc.
+"""
+
+from rumba.model import *
+from rumba.utils import ExperimentManager
+
+# import testbed plugins
+import rumba.testbeds.local as local
+
+# import prototype plugins
+import rumba.prototypes.ouroboros as our
+
+import rumba.log as log
+
+log.set_logging_level('DEBUG')
+
+# -----------------------------------------------------------------------
+# Layer-centric syntax
+# -----------------------------------------------------------------------
+
+# Define layers
+top = UnicastLayer("top")
+mid = UnicastLayer("mid")
+top.add_policy("rmt.pff", "lfa")
+
+# Ethernet layers model point-to-point links
+e1 = EthDixLayer("e1")
+e2 = EthDixLayer("e2")
+e3 = EthDixLayer("e3")
+
+# Define nodes and their layer memberships + registrations
+a = Node("a",
+ layers=[top, mid, e1, e2],
+ registrations={mid: [e1, e2],
+ top: [mid]})
+
+b = Node("b",
+ layers=[mid, e1, e3],
+ registrations={mid: [e1, e3],
+ })
+
+c = Node("c",
+ layers=[top, mid, e2, e3],
+ registrations={mid: [e2, e3],
+ top: [mid]})
+
+# Create testbed and experiment
+tb = local.Testbed(exp_name="layer-example")
+exp = our.Experiment(tb, nodes=[a, b, c])
+
+print(exp)
+
+# Use properties from the API
+for layer in exp.layer_ordering:
+ print("Layer: %s (type=%s, is_eth=%s, is_shim=%s)" % (
+ layer.name, layer.layer_type.value, layer.is_eth, layer.is_shim))
+
+with ExperimentManager(exp):
+ exp.swap_in()
+ exp.install_prototype()
+ exp.bootstrap_prototype()