Skip to content

Commit

Permalink
Merge pull request #16726 from LabNConsulting/native-munet-topotest
Browse files Browse the repository at this point in the history
fix native munet topotest
  • Loading branch information
donaldsharp authored Sep 3, 2024
2 parents 745cd3e + a88f3c2 commit 1e2ccf1
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/topotests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

try:
# Used by munet native tests
from munet.testing.fixtures import event_loop, unet # pylint: disable=all # noqa
from munet.testing.fixtures import unet # pylint: disable=all # noqa

@pytest.fixture(scope="module")
def rundir_module(pytestconfig):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/example_munet/r1/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ service integrated-vtysh-config
interface eth0
ip address 10.0.1.1/24

ip route 10.0.0.0/8 blackhole
ip route 10.0.2.0/24 10.0.1.2
4 changes: 1 addition & 3 deletions tests/topotests/example_munet/r2/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ interface eth0
ip address 10.0.1.2/24

interface eth1
ip address 10.0.2.2/24

ip route 10.0.0.0/8 blackhole
ip address 10.0.2.2/24
2 changes: 1 addition & 1 deletion tests/topotests/example_munet/r3/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ service integrated-vtysh-config
interface eth0
ip address 10.0.2.3/24

ip route 10.0.0.0/8 blackhole
ip route 10.0.1.0/24 10.0.2.2
18 changes: 17 additions & 1 deletion tests/topotests/example_munet/test_munet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
#
# Copyright (c) 2023, LabN Consulting, L.L.C.
#
from munet.testing.util import retry


@retry(retry_timeout=10)
def wait_for_route(r, p):
o = r.cmd_raises(f"ip route show {p}")
assert p in o


async def test_native_test(unet):
o = unet.hosts["r1"].cmd_nostatus("ip addr")
r1 = unet.hosts["r1"]
o = r1.cmd_nostatus("ip addr")
print(o)

wait_for_route(r1, "10.0.2.0/24")

r1.cmd_raises("ping -c1 10.0.1.2")
r1.cmd_raises("ping -c1 10.0.2.2")
r1.cmd_raises("ping -c1 10.0.2.3")
3 changes: 2 additions & 1 deletion tests/topotests/kinds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ kinds:
/usr/lib/frr/frrinit.sh stop
volumes:
- "./%NAME%:/etc/frr"
- "%RUNDIR%/var.lib.frr:/var/lib/frr"
- "%RUNDIR%/var.log.frr:/var/log/frr"
- "%RUNDIR%/var.run.frr:/var/run/frr"
- "%RUNDIR%/var.lib.frr:/var/lib/frr"
- "%RUNDIR%/var.tmp.frr:/var/tmp/frr"
cap-add:
- SYS_ADMIN
- AUDIT_WRITE
Expand Down
2 changes: 2 additions & 0 deletions tests/topotests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Skip pytests example directory
[pytest]

asyncio_mode = auto

# NEEDS_EXABGP_4_2_11_FRR

# asyncio_mode = auto
Expand Down

0 comments on commit 1e2ccf1

Please sign in to comment.