Skip to content

Commit

Permalink
tests: add. iproute2 VRF capability check example
Browse files Browse the repository at this point in the history
Additional example usage of iproute2_is_vrf_capable check in
isis-topo1-vrf topotest.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
  • Loading branch information
davischw committed Mar 16, 2021
1 parent ddbc1ad commit 83d2076
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.topotest import iproute2_is_vrf_capable
from lib.common_config import required_linux_kernel_version

from mininet.topo import Topo

Expand Down Expand Up @@ -193,18 +195,21 @@ def test_isis_route_installation():


def test_isis_linux_route_installation():

dist = platform.dist()

if dist[1] == "16.04":
pytest.skip("Kernel not supported for vrf")

"Check whether all expected routes are present and installed in the OS"
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

# Required linux kernel version for this suite to run.
result = required_linux_kernel_version("4.15")
if result is not True:
pytest.skip("Kernel requirements are not met")

# iproute2 needs to support VRFs for this suite to run.
if not iproute2_is_vrf_capable():
pytest.skip("Installed iproute2 version does not support VRFs")

logger.info("Checking routers for installed ISIS vrf routes in OS")
# Check for routes in `ip route show vrf {}-cust1`
for rname, router in tgen.routers().items():
Expand Down Expand Up @@ -236,18 +241,21 @@ def test_isis_route6_installation():


def test_isis_linux_route6_installation():

dist = platform.dist()

if dist[1] == "16.04":
pytest.skip("Kernel not supported for vrf")

"Check whether all expected routes are present and installed in the OS"
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

# Required linux kernel version for this suite to run.
result = required_linux_kernel_version("4.15")
if result is not True:
pytest.skip("Kernel requirements are not met")

# iproute2 needs to support VRFs for this suite to run.
if not iproute2_is_vrf_capable():
pytest.skip("Installed iproute2 version does not support VRFs")

logger.info("Checking routers for installed ISIS vrf IPv6 routes in OS")
# Check for routes in `ip -6 route show vrf {}-cust1`
for rname, router in tgen.routers().items():
Expand Down

0 comments on commit 83d2076

Please sign in to comment.