diff --git a/examples/frr/ospf/mutest/munet.yaml b/examples/frr/ospf/mutest/munet.yaml new file mode 100644 index 0000000..7d3d068 --- /dev/null +++ b/examples/frr/ospf/mutest/munet.yaml @@ -0,0 +1,48 @@ +version: 1 + +topology: + networks-autonumber: true + networks: + - name: net1 + - name: net2 + - name: net3 + nodes: + - name: r1 + kind: frr + connections: ["net1", "net2"] + - name: r2 + kind: frr + connections: ["net1", "net3"] + - name: r3 + kind: frr + connections: ["net2", "net3"] + +kinds: + - name: frr + cap-add: + - SYS_ADMIN + - AUDIT_WRITE + cmd: | + chown frr:frr -R /var/run/frr + chown frr:frr -R /var/log/frr + /usr/lib/frr/frrinit.sh start + tail -F /var/log/frr/frr.log + # cleanup-cmd: | + # /usr/lib/frr/frrinit.sh stop + volumes: + - "./%NAME%/etc.frr:/etc/frr" + - "%RUNDIR%/var.log.frr:/var/log/frr" + - "%RUNDIR%/var.run.frr:/var/run/frr" + +cli: + commands: + - name: "" + exec: "vtysh -c '{}'" + format: "[ROUTER ...] COMMAND" + help: "execute vtysh COMMAND on the router[s]" + kinds: ["frr"] + - name: "vtysh" + exec: "/usr/bin/vtysh" + format: "vtysh ROUTER [ROUTER ...]" + new-window: true + kinds: ["frr"] diff --git a/examples/mutest/mutest_ospf.py b/examples/frr/ospf/mutest/mutest_ospf.py similarity index 100% rename from examples/mutest/mutest_ospf.py rename to examples/frr/ospf/mutest/mutest_ospf.py diff --git a/examples/mutest/r1/etc.frr/daemons b/examples/frr/ospf/mutest/r1/etc.frr/daemons similarity index 100% rename from examples/mutest/r1/etc.frr/daemons rename to examples/frr/ospf/mutest/r1/etc.frr/daemons diff --git a/examples/mutest/r1/etc.frr/frr.conf b/examples/frr/ospf/mutest/r1/etc.frr/frr.conf similarity index 100% rename from examples/mutest/r1/etc.frr/frr.conf rename to examples/frr/ospf/mutest/r1/etc.frr/frr.conf diff --git a/examples/mutest/r1/etc.frr/vtysh.conf b/examples/frr/ospf/mutest/r1/etc.frr/vtysh.conf similarity index 100% rename from examples/mutest/r1/etc.frr/vtysh.conf rename to examples/frr/ospf/mutest/r1/etc.frr/vtysh.conf diff --git a/examples/mutest/r2/etc.frr/daemons b/examples/frr/ospf/mutest/r2/etc.frr/daemons similarity index 100% rename from examples/mutest/r2/etc.frr/daemons rename to examples/frr/ospf/mutest/r2/etc.frr/daemons diff --git a/examples/mutest/r2/etc.frr/frr.conf b/examples/frr/ospf/mutest/r2/etc.frr/frr.conf similarity index 100% rename from examples/mutest/r2/etc.frr/frr.conf rename to examples/frr/ospf/mutest/r2/etc.frr/frr.conf diff --git a/examples/mutest/r2/etc.frr/vtysh.conf b/examples/frr/ospf/mutest/r2/etc.frr/vtysh.conf similarity index 100% rename from examples/mutest/r2/etc.frr/vtysh.conf rename to examples/frr/ospf/mutest/r2/etc.frr/vtysh.conf diff --git a/examples/mutest/r3/etc.frr/daemons b/examples/frr/ospf/mutest/r3/etc.frr/daemons similarity index 100% rename from examples/mutest/r3/etc.frr/daemons rename to examples/frr/ospf/mutest/r3/etc.frr/daemons diff --git a/examples/mutest/r3/etc.frr/frr.conf b/examples/frr/ospf/mutest/r3/etc.frr/frr.conf similarity index 100% rename from examples/mutest/r3/etc.frr/frr.conf rename to examples/frr/ospf/mutest/r3/etc.frr/frr.conf diff --git a/examples/mutest/r3/etc.frr/vtysh.conf b/examples/frr/ospf/mutest/r3/etc.frr/vtysh.conf similarity index 100% rename from examples/mutest/r3/etc.frr/vtysh.conf rename to examples/frr/ospf/mutest/r3/etc.frr/vtysh.conf diff --git a/examples/mutest/munet.yaml b/examples/mutest/munet.yaml index 7d3d068..7c4e3c0 100644 --- a/examples/mutest/munet.yaml +++ b/examples/mutest/munet.yaml @@ -1,48 +1,10 @@ version: 1 - topology: networks-autonumber: true networks: - name: net1 - - name: net2 - - name: net3 nodes: - - name: r1 - kind: frr - connections: ["net1", "net2"] - - name: r2 - kind: frr - connections: ["net1", "net3"] - - name: r3 - kind: frr - connections: ["net2", "net3"] - -kinds: - - name: frr - cap-add: - - SYS_ADMIN - - AUDIT_WRITE - cmd: | - chown frr:frr -R /var/run/frr - chown frr:frr -R /var/log/frr - /usr/lib/frr/frrinit.sh start - tail -F /var/log/frr/frr.log - # cleanup-cmd: | - # /usr/lib/frr/frrinit.sh stop - volumes: - - "./%NAME%/etc.frr:/etc/frr" - - "%RUNDIR%/var.log.frr:/var/log/frr" - - "%RUNDIR%/var.run.frr:/var/run/frr" - -cli: - commands: - - name: "" - exec: "vtysh -c '{}'" - format: "[ROUTER ...] COMMAND" - help: "execute vtysh COMMAND on the router[s]" - kinds: ["frr"] - - name: "vtysh" - exec: "/usr/bin/vtysh" - format: "vtysh ROUTER [ROUTER ...]" - new-window: true - kinds: ["frr"] + - name: h1 + connections: ["net1"] + - name: h2 + connections: ["net1"] diff --git a/examples/mutest/mutest_shell.py b/examples/mutest/mutest_shell.py new file mode 100644 index 0000000..4ab87ee --- /dev/null +++ b/examples/mutest/mutest_shell.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 eval: (blacken-mode 1) -*- +# SPDX-License-Identifier: GPL-2.0-or-later +# +# April 12 2024, Christian Hopps +# +# Copyright (c) 2024, LabN Consulting, L.L.C. +"""Example mutest.""" +from munet.mutest.userapi import match_step +from munet.mutest.userapi import section +from munet.mutest.userapi import step +from munet.mutest.userapi import wait_step + + +section("Tests to show use of steps.") + +match_step( + "h1", + "ping -c1 10.0.1.2", + match="0% packet loss", + desc="h1 pings h2", +) + +step("h1", "(sleep 2 && touch foo) &") + +wait_step( + "h1", + "ls", + "foo", + "found file foo", +)