mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
Merge pull request #10143 from donaldsharp/lib_kernel_routes
test: Fix addKernelRoute looking for positive results
This commit is contained in:
commit
be8a6654b9
@ -26,6 +26,7 @@ import socket
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import functools
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@ -2970,7 +2971,9 @@ def addKernelRoute(
|
|||||||
logger.info("[DUT: {}]: Running command: [{}]".format(router, cmd))
|
logger.info("[DUT: {}]: Running command: [{}]".format(router, cmd))
|
||||||
output = rnode.run(cmd)
|
output = rnode.run(cmd)
|
||||||
|
|
||||||
|
def check_in_kernel(rnode, verify_cmd, grp_addr, router):
|
||||||
# Verifying if ip route added to kernal
|
# Verifying if ip route added to kernal
|
||||||
|
errormsg = None
|
||||||
result = rnode.run(verify_cmd)
|
result = rnode.run(verify_cmd)
|
||||||
logger.debug("{}\n{}".format(verify_cmd, result))
|
logger.debug("{}\n{}".format(verify_cmd, result))
|
||||||
if "/" in grp_addr:
|
if "/" in grp_addr:
|
||||||
@ -2983,11 +2986,19 @@ def addKernelRoute(
|
|||||||
if not re_search(r"{}".format(grp_addr), result) and mask != "0":
|
if not re_search(r"{}".format(grp_addr), result) and mask != "0":
|
||||||
errormsg = (
|
errormsg = (
|
||||||
"[DUT: {}]: Kernal route is not added for group"
|
"[DUT: {}]: Kernal route is not added for group"
|
||||||
" address {} Config output: {}".format(router, grp_addr, output)
|
" address {} Config output: {}".format(
|
||||||
|
router, grp_addr, output
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return errormsg
|
return errormsg
|
||||||
|
|
||||||
|
test_func = functools.partial(
|
||||||
|
check_in_kernel, rnode, verify_cmd, grp_addr, router
|
||||||
|
)
|
||||||
|
(result, out) = topotest.run_and_expect(test_func, None, count=20, wait=1)
|
||||||
|
assert result, out
|
||||||
|
|
||||||
logger.debug("Exiting lib API: addKernelRoute()")
|
logger.debug("Exiting lib API: addKernelRoute()")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user