tests: Ensure packets have a chance to arrive in test_multicast_pim_sm_topo4.py

The test is doing this:

a) gather interface data about packets sent
b) shut interface
c) no shut interface
d) gather interface data about packets sent
e) compare a to d and fail if packets sent/received has not incremented

The problem is, of course, that under heavy system load insufficient time
might not have passed for packets to be sent between c and d.  Add up to
35 seconds of looking for packet data being incremented else heavily
loaded systems may never show that data is being sent.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-01-07 09:15:19 -05:00
parent 715d3774aa
commit 758999b3e0

View File

@ -83,6 +83,8 @@ from lib.pim import (
)
from lib.topolog import logger
from lib.topojson import build_config_from_json
from time import sleep
TOPOLOGY = """
@ -946,7 +948,11 @@ def test_PIM_hello_tx_rx_p1(request):
)
shutdown_bringup_interface(tgen, "c1", intf_c1_l1, True)
step("verify stats after on c1")
step("verify stats after on c1 and that they are incremented")
count = 0
done = False
while not done and count <= 7:
c1_state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
c1_state_after, dict
@ -954,8 +960,13 @@ def test_PIM_hello_tx_rx_p1(request):
tc_name, result
)
step("verify stats incremented on c1")
result = verify_state_incremented(c1_state_before, c1_state_after)
if result is not True:
sleep(5)
count += 1
else:
done = True
assert (
result is True
), "Testcase{} : Failed Error: {}" "stats is not incremented".format(
@ -985,7 +996,10 @@ def test_PIM_hello_tx_rx_p1(request):
)
shutdown_bringup_interface(tgen, "l1", intf_l1_c1, True)
step("verify stats after on l1")
step("verify stats after on l1 are incremented")
count = 0
done = False
while not done and count <= 7:
l1_state_after = get_pim_interface_traffic(tgen, l1_state_dict)
assert isinstance(
l1_state_after, dict
@ -993,8 +1007,13 @@ def test_PIM_hello_tx_rx_p1(request):
tc_name, result
)
step("verify stats not incremented on l1")
result = verify_state_incremented(l1_state_before, l1_state_after)
if result is True:
sleep(5)
count += 1
else:
done = True
assert (
result is not True
), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name, result)
@ -1035,7 +1054,10 @@ def test_PIM_hello_tx_rx_p1(request):
result = apply_raw_config(tgen, raw_config)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("verify stats after on c1")
step("verify stats after on c1 are incremented")
count = 0
done = False
while not done and count <= 7:
c1_state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
c1_state_after, dict
@ -1043,8 +1065,13 @@ def test_PIM_hello_tx_rx_p1(request):
tc_name, result
)
step("verify stats incremented on c1")
result = verify_state_incremented(c1_state_before, c1_state_after)
if result is not True:
sleep(5)
count += 1
else:
done = True
assert result is True, "Testcase{} : Failed Error: {}" "stats incremented".format(
tc_name, result
)