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
18 changes: 18 additions & 0 deletions tests/bmp/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ def disable_bmp_rib_out_table(duthost):
return ret


def disable_bmp_feature(duthost):

cmd_disable_feature = 'sudo config feature state bmp disabled'
logging.debug("cmd_disable_feature command is: {}".format(cmd_disable_feature))
ret = duthost.command(cmd_disable_feature, module_ignore_errors=True)
logging.debug("cmd_disable_feature output is: {}".format(ret))
return ret


def enable_bmp_feature(duthost):

cmd_enable_feature = 'sudo config feature state bmp enabled'
logging.debug("cmd_enable_feature command is: {}".format(cmd_enable_feature))
ret = duthost.command(cmd_enable_feature, module_ignore_errors=True)
logging.debug("cmd_enable_feature output is: {}".format(ret))
return ret


"""
Usage: show bmp [OPTIONS] COMMAND [ARGS]...

Expand Down
18 changes: 18 additions & 0 deletions tests/bmp/test_frr_bmp_sanity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytest
from tests.common.helpers.monit import check_monit_expected_container_logging
from tests.common.utilities import wait_until
from bmp.helper import enable_bmp_feature, disable_bmp_feature

pytestmark = [
pytest.mark.topology('any', 't0-sonic', 't1-multi-asic'),
pytest.mark.device_type('vs')
]


def test_frr_bmp_monit_log(duthosts, enum_frontend_dut_hostname, enum_asic_index):
duthost = duthosts[enum_frontend_dut_hostname]
disable_bmp_feature(duthost)

wait_until(180, 60, 0, check_monit_expected_container_logging, duthost)

enable_bmp_feature(duthost)
14 changes: 14 additions & 0 deletions tests/common/helpers/monit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from tests.common.helpers.assertions import pytest_assert


def check_monit_expected_container_logging(duthost):
"""Checks whether alerting message appears as syslog if
there is unexpected container not running.
Args:
duthost: An AnsibleHost object of DuT.
Returns:
None.
"""
syslog_output = duthost.command("sudo grep 'ERR monit' /var/log/syslog")["stdout"]
pytest_assert("Expected containers not running" not in syslog_output,
f"Expected containers not running found in syslog. Output was:\n{syslog_output}")
14 changes: 1 addition & 13 deletions tests/monit/test_monit_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from tests.common.utilities import wait_until
from tests.common.helpers.assertions import pytest_assert
from tests.common.helpers.assertions import pytest_require
from tests.common.helpers.monit import check_monit_expected_container_logging

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -77,19 +78,6 @@ def check_monit_last_output(duthost):
return False


def check_monit_expected_container_logging(duthost):
"""Checks whether alerting message appears as syslog if
there is unexpected container not running.
Args:
duthost: An AnsibleHost object of DuT.
Returns:
None.
"""
syslog_output = duthost.command("sudo grep 'ERR monit' /var/log/syslog")["stdout"]
pytest_assert("Expected containers not running" not in syslog_output,
f"Expected containers not running found in syslog. Output was:\n{syslog_output}")


def test_monit_status(duthosts, enum_rand_one_per_hwsku_frontend_hostname):
"""Checks whether the Monit service was running or not.

Expand Down
Loading