Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/platform_tests/link_flap/link_flap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time

from tests.common.platform.device_utils import fanout_switch_port_lookup, __get_dut_if_status
from tests.common.utilities import get_day_of_week_distributed_ports_from_buckets

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,6 +71,8 @@ def build_test_candidates(dut, fanouthosts, port, completeness_level=None):

if completeness_level == 'debug':
candidates = random.sample(candidates, 1)
elif completeness_level == 'confident':
candidates = get_day_of_week_distributed_ports_from_buckets(candidates, 32)

return candidates

Expand Down
37 changes: 24 additions & 13 deletions tests/platform_tests/link_flap/test_cont_link_flap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
from tests.common.devices.eos import EosHost
from tests.common.devices.sonic import SonicHost
from tests.common.platform.device_utils import toggle_one_link
from tests.common.plugins.test_completeness import CompletenessLevel

pytestmark = [
pytest.mark.disable_route_check,
pytest.mark.disable_loganalyzer,
pytest.mark.topology('any')
pytest.mark.topology('any'),
pytest.mark.supported_completeness_level(CompletenessLevel.confident, CompletenessLevel.thorough)
]


Expand All @@ -35,6 +37,13 @@ class TestContLinkFlap(object):
TestContLinkFlap class for continuous link flap
"""

@staticmethod
def get_candidates(duthost, fanouthosts, completeness_level="confident"):
candidates = build_test_candidates(duthost, fanouthosts, 'all_ports', completeness_level=completeness_level)
pytest_require(candidates, "Didn't find any port that is admin up and present in the connection graph")
logging.info("Randomly selected candidates: %s", candidates)
return candidates

def get_frr_daemon_memory_usage(self, duthost, daemon):
frr_daemon_memory_per_asics = {}

Expand Down Expand Up @@ -84,9 +93,9 @@ def test_cont_link_flap(self, request, duthosts, nbrhosts, enum_rand_one_per_hws
Validates that continuous link flap works as expected

Test steps:
1.) Flap all interfaces one by one in 1-3 iteration
1.) Flap randomly sampled interfaces one by one in 1-3 iteration
to cause BGP Flaps.
2.) Flap all interfaces on peer (FanOutLeaf) one by one 1-3 iteration
2.) Flap randomly sampled interfaces on peer (FanOutLeaf) one by one 1-3 iteration
to cause BGP Flaps.
3.) Watch for memory (show system-memory), FRR daemons memory(vtysh -c "show memory bgp/zebra"),
orchagent CPU Utilization and Redis_memory.
Expand All @@ -97,6 +106,9 @@ def test_cont_link_flap(self, request, duthosts, nbrhosts, enum_rand_one_per_hws
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
duthost.command("sonic-clear arp")
orch_cpu_threshold = request.config.getoption("--orch_cpu_threshold")
completeness_level = request.config.getoption("--completeness_level")
if not completeness_level or completeness_level not in ["confident", "thorough"]:
completeness_level = "confident"

# Record memory status at start
memory_output = duthost.shell("show system-memory")["stdout"]
Expand Down Expand Up @@ -138,19 +150,18 @@ def test_cont_link_flap(self, request, duthosts, nbrhosts, enum_rand_one_per_hws
.format(duthost.shell("show processes cpu | grep orchagent | awk '{print $9}'")["stdout"],
orch_cpu_threshold))

# Flap all interfaces one by one on DUT
# Flap randomly sampled interfaces one by one on DUT
for iteration in range(3):
logging.info("%d Iteration flap all interfaces one by one on DUT", iteration + 1)
port_toggle(duthost, tbinfo, watch=True)
logging.info("%d Iteration flap randomly sampled interfaces one by one on DUT", iteration + 1)
selected_candidates = self.get_candidates(duthost, fanouthosts, completeness_level=completeness_level)
selected_ports = [dut_port for dut_port, fanout, fanout_port in selected_candidates]
port_toggle(duthost, tbinfo, ports=selected_ports, wait_after_ports_up=30, watch=True)

# Flap all interfaces one by one on Peer Device
# Flap randomly sampled interfaces one by one on Peer Device
for iteration in range(3):
logging.info("%d Iteration flap all interfaces one by one on Peer Device", iteration + 1)
candidates = build_test_candidates(duthost, fanouthosts, 'all_ports')

pytest_require(candidates, "Didn't find any port that is admin up and present in the connection graph")

for dut_port, fanout, fanout_port in candidates:
logging.info("%d Iteration flap randomly sampled interfaces one by one on Peer Device", iteration + 1)
selected_candidates = self.get_candidates(duthost, fanouthosts, completeness_level=completeness_level)
for dut_port, fanout, fanout_port in selected_candidates:
toggle_one_link(duthost, dut_port, fanout, fanout_port, watch=True)

# Make Sure all ipv4/ipv6 routes are relearned with jitter of ~5
Expand Down
Loading