mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
tests: add a non-json simple ospf test for development
This simple OSPF test utilizes less "magic" testing infrastructure. This is useful when doing OSPF development as a quick way to enable a feature to help test or develop it. Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
02ce913405
commit
2656eb089a
25
tests/topotests/ospf_simple/r1/frr.conf
Normal file
25
tests/topotests/ospf_simple/r1/frr.conf
Normal file
|
@ -0,0 +1,25 @@
|
|||
log timestamp precision 6
|
||||
log file frr.log
|
||||
|
||||
debug northbound notifications
|
||||
debug northbound libyang
|
||||
debug northbound events
|
||||
debug northbound callbacks
|
||||
|
||||
debug mgmt backend datastore frontend transaction
|
||||
debug mgmt client frontend
|
||||
|
||||
debug mgmt client backend
|
||||
|
||||
interface r1-eth0
|
||||
ip address 10.0.1.1/24
|
||||
ip ospf hello-interval 3
|
||||
ip ospf dead-interval 10
|
||||
ip ospf retransmit-interval 2
|
||||
|
||||
ip route 11.0.0.0/8 Null0
|
||||
|
||||
router ospf
|
||||
ospf router-id 1.1.1.1
|
||||
network 10.0.0.0/16 area 0.0.0.0
|
||||
redistribute static
|
17
tests/topotests/ospf_simple/r2/frr.conf
Normal file
17
tests/topotests/ospf_simple/r2/frr.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
interface r2-eth0
|
||||
ip address 10.0.1.2/24
|
||||
ip ospf hello-interval 3
|
||||
ip ospf dead-interval 10
|
||||
ip ospf retransmit-interval 2
|
||||
interface r2-eth1
|
||||
ip address 10.0.2.2/24
|
||||
ip ospf hello-interval 3
|
||||
ip ospf dead-interval 10
|
||||
ip ospf retransmit-interval 2
|
||||
|
||||
ip route 22.0.0.0/8 Null0
|
||||
|
||||
router ospf
|
||||
ospf router-id 2.2.2.2
|
||||
network 10.0.0.0/16 area 0.0.0.0
|
||||
redistribute static
|
12
tests/topotests/ospf_simple/r3/frr.conf
Normal file
12
tests/topotests/ospf_simple/r3/frr.conf
Normal file
|
@ -0,0 +1,12 @@
|
|||
interface r3-eth0
|
||||
ip address 10.0.2.3/24
|
||||
ip ospf hello-interval 3
|
||||
ip ospf dead-interval 10
|
||||
ip ospf retransmit-interval 2
|
||||
|
||||
ip route 33.0.0.0/8 Null0
|
||||
|
||||
router ospf
|
||||
ospf router-id 3.3.3.3
|
||||
network 10.0.0.0/16 area 0.0.0.0
|
||||
redistribute static
|
74
tests/topotests/ospf_simple/test_ospf_simple.py
Normal file
74
tests/topotests/ospf_simple/test_ospf_simple.py
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 eval: (blacken-mode 1) -*-
|
||||
# SPDX-License-Identifier: ISC
|
||||
#
|
||||
# <template>.py
|
||||
# Part of NetDEF Topology Tests
|
||||
#
|
||||
# Copyright (c) 2017 by
|
||||
# Network Device Education Foundation, Inc. ("NetDEF")
|
||||
#
|
||||
|
||||
"""
|
||||
<template>.py: Test <template>.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from lib.topogen import Topogen, TopoRouter
|
||||
from lib.topolog import logger
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.ospfd,
|
||||
]
|
||||
|
||||
|
||||
# New form of setup/teardown using pytest fixture
|
||||
@pytest.fixture(scope="module")
|
||||
def tgen(request):
|
||||
"Setup/Teardown the environment and provide tgen argument to tests"
|
||||
|
||||
topodef = {
|
||||
"s0": ("r1", "r2"),
|
||||
"s1": ("r2", "r3"),
|
||||
}
|
||||
|
||||
tgen = Topogen(topodef, request.module.__name__)
|
||||
|
||||
tgen.start_topology()
|
||||
router_list = tgen.routers()
|
||||
|
||||
for rname, router in router_list.items():
|
||||
router.load_frr_config("frr.conf")
|
||||
|
||||
tgen.start_router()
|
||||
|
||||
yield tgen
|
||||
tgen.stop_topology()
|
||||
|
||||
|
||||
# Fixture that executes before each test
|
||||
@pytest.fixture(autouse=True)
|
||||
def skip_on_failure(tgen):
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip("skipped because of previous test failure")
|
||||
|
||||
|
||||
# ===================
|
||||
# The tests functions
|
||||
# ===================
|
||||
|
||||
|
||||
def test_get_version(tgen):
|
||||
"Test the logs the FRR version"
|
||||
|
||||
# tgen.gears["r1"].net.cmd_nostatus(
|
||||
# "vtysh -c 'debug ospfd client frontend' " "-c 'debug ospfd client backend' "
|
||||
# )
|
||||
|
||||
# stepf("about to get version")
|
||||
|
||||
r1 = tgen.gears["r1"]
|
||||
version = r1.vtysh_cmd("show version")
|
||||
logger.info("FRR version is: " + version)
|
Loading…
Reference in a new issue