mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
tests: Add some test cases for missed coverage
I noticed that there was some missed code coverage in zebra. multicast [enable|disable] and show interface description vrf all Add a bit to get it covered. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
069dff269e
commit
c23f505f45
|
@ -20,6 +20,7 @@ import sys
|
|||
import pytest
|
||||
import glob
|
||||
from time import sleep
|
||||
from lib.topolog import logger
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.babeld,
|
||||
|
@ -1715,6 +1716,77 @@ def test_resilient_nexthop_group():
|
|||
net["r1"].cmd('vtysh -c "conf" -c "no nexthop-group resilience"')
|
||||
|
||||
|
||||
def test_interface_stuff():
|
||||
global fatal_error
|
||||
net = get_topogen().net
|
||||
|
||||
# Skip if previous fatal error condition is raised
|
||||
if fatal_error != "":
|
||||
pytest.skip(fatal_error)
|
||||
|
||||
print("\n\n** Verifying some interface code")
|
||||
print("************************************\n")
|
||||
|
||||
net["r1"].cmd('vtysh -c "conf" -c "interface r1-eth0" -c "multicast enable"')
|
||||
|
||||
def _test_interface_multicast_on():
|
||||
output = json.loads(net["r1"].cmd('vtysh -c "show int r1-eth0 json"'))
|
||||
expected = {
|
||||
"r1-eth0": {
|
||||
"flags": "<UP,LOWER_UP,BROADCAST,RUNNING,MULTICAST>",
|
||||
"multicastConfig": "Enabled by CLI",
|
||||
}
|
||||
}
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
test_func = functools.partial(_test_interface_multicast_on)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||
assert result is None, "Multicast bit was not set on r1-eth0"
|
||||
|
||||
net["r1"].cmd('vtysh -c "conf" -c "interface r1-eth0" -c "multicast disable"')
|
||||
|
||||
def _test_interface_multicast_off():
|
||||
output = json.loads(
|
||||
net["r1"].cmd('vtysh -c "show int r1-eth0 vrf default json"')
|
||||
)
|
||||
expected = {
|
||||
"r1-eth0": {
|
||||
"flags": "<UP,LOWER_UP,BROADCAST,RUNNING>",
|
||||
"multicastConfig": "Disabled by CLI",
|
||||
}
|
||||
}
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
test_func = functools.partial(_test_interface_multicast_off)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||
assert result is None, "Multicast bit was not turned off on r1-eth0"
|
||||
|
||||
net["r1"].cmd('vtysh -c "conf" -c "interface r1-eth0" -c "no multicast disable"')
|
||||
|
||||
def _test_interface_multicast_disable():
|
||||
output = json.loads(net["r1"].cmd('vtysh -c "show int r1-eth0 json"'))
|
||||
expected = {
|
||||
"r1-eth0": {
|
||||
"flags": "<UP,LOWER_UP,BROADCAST,RUNNING>",
|
||||
"multicastConfig": "Not specified by CLI",
|
||||
}
|
||||
}
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
test_func = functools.partial(_test_interface_multicast_disable)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||
assert result is None, "Multicast bit was set on r1-eth0"
|
||||
|
||||
logger.info("Ensure that these commands are still nominally working")
|
||||
rc, o, e = net["r1"].cmd_status('vtysh -c "show interface description vrf all"')
|
||||
logger.info(o)
|
||||
assert rc == 0
|
||||
|
||||
rc, o, e = net["r1"].cmd_status('vtysh -c "show interface description vrf default"')
|
||||
logger.info(o)
|
||||
assert rc == 0
|
||||
|
||||
|
||||
def test_shutdown_check_stderr():
|
||||
global fatal_error
|
||||
net = get_topogen().net
|
||||
|
|
Loading…
Reference in a new issue