Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add multi-asic in test_cont_link_flap #14673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
49 changes: 32 additions & 17 deletions tests/platform_tests/link_flap/test_cont_link_flap.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@ class TestContLinkFlap(object):
"""

def get_frr_daemon_memory_usage(self, duthost, daemon):
frr_daemon_memory_output = duthost.shell(f'vtysh -c "show memory {daemon}"')["stdout"]
logging.info(f"{daemon} memory status: \n%s", frr_daemon_memory_output)
frr_daemon_memory = duthost.shell(
f'vtysh -c "show memory {daemon}" | grep "Used ordinary blocks"')["stdout"].split()[-2]
return frr_daemon_memory
frr_daemon_memory_per_asics = []

for asic in duthost.asics:
frr_daemon_memory_output = asic.run_vtysh(f'-c "show memory {daemon}"')["stdout"]

logging.info(
f"{daemon}{('-' + asic.namespace) if asic.namespace else ''} memory status: \n%s",
frr_daemon_memory_output
)

frr_daemon_memory = asic.run_vtysh(
f'-c "show memory {daemon}" | grep "Used ordinary blocks"'
)["stdout"].split()[-2]

frr_daemon_memory_per_asics.append(frr_daemon_memory)

return frr_daemon_memory_per_asics

def test_cont_link_flap(self, request, duthosts, nbrhosts, enum_rand_one_per_hwsku_frontend_hostname,
fanouthosts, bring_up_dut_interfaces, tbinfo):
Expand Down Expand Up @@ -164,18 +176,21 @@ def test_cont_link_flap(self, request, duthosts, nbrhosts, enum_rand_one_per_hws
logging.info(f"{daemon} memory usage at end: \n%s", end_time_frr_daemon_memory[daemon])

# Calculate diff in FRR daemon memory
incr_frr_daemon_memory = \
float(end_time_frr_daemon_memory[daemon]) - float(start_time_frr_daemon_memory[daemon])
logging.info(f"{daemon} absolute difference: %d", incr_frr_daemon_memory)

# Check FRR daemon memory only if it is increased else default to pass
if incr_frr_daemon_memory > 0:
percent_incr_frr_daemon_memory = \
(incr_frr_daemon_memory / float(start_time_frr_daemon_memory[daemon])) * 100
logging.info(f"{daemon} memory percentage increase: %d", percent_incr_frr_daemon_memory)
pytest_assert(percent_incr_frr_daemon_memory < incr_frr_daemon_memory_threshold[daemon],
f"{daemon} memory increase more than expected: "
f"{incr_frr_daemon_memory_threshold[daemon]}%")
for asic_index, asic in enumerate(duthost.asics):
incr_frr_daemon_memory = float(end_time_frr_daemon_memory[daemon][asic_index]) - \
float(start_time_frr_daemon_memory[daemon][asic_index])

daemon_name = daemon if not duthost.is_multi_asic else f"{daemon}-{asic.namespace}"
logging.info(f"{daemon_name} absolute difference: %d", incr_frr_daemon_memory)

# Check FRR daemon memory only if it is increased else default to pass
if incr_frr_daemon_memory > 0:
percent_incr_frr_daemon_memory = \
(incr_frr_daemon_memory / float(start_time_frr_daemon_memory[daemon][asic_index])) * 100
logging.info(f"{daemon_name} memory percentage increase: %d", percent_incr_frr_daemon_memory)
pytest_assert(percent_incr_frr_daemon_memory < incr_frr_daemon_memory_threshold[daemon][asic_index],
f"{daemon_name} memory increase more than expected: "
f"{incr_frr_daemon_memory_threshold[daemon][asic_index]}%")

# Record orchagent CPU utilization at end
orch_cpu = duthost.shell(
Expand Down
Loading