Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1,8 @@

import pytest
import logging
from tests.common.helpers.bmp_utils import BMPEnvironment
from tests.common import config_reload


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -128,3 +130,19 @@ def show_bmp_tables(duthost):
ret = duthost.command(cmd_show_tables, module_ignore_errors=True)
logging.debug("show_bmp_tables output is: {}".format(ret))
return ret


@pytest.fixture
def enable_bmp_feature(duthosts, enum_rand_one_per_hwsku_frontend_hostname):

duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
duthost.shell('sudo config feature state bmp enabled')
duthost.shell('sudo config save -y')
# Config reload is needed so that bgpd can restart with `-M bmp` argument
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True, wait_for_bgp=True)

yield

duthost.shell('sudo config feature state bmp disabled')
duthost.shell('sudo config save -y')
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True, wait_for_bgp=True)
7 changes: 4 additions & 3 deletions tests/bmp/test_bmp_statedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
import re
import json
from bmp.helper import enable_bmp_neighbor_table, enable_bmp_rib_in_table, enable_bmp_rib_out_table
from bmp.helper import enable_bmp_neighbor_table, enable_bmp_rib_in_table, enable_bmp_rib_out_table, enable_bmp_feature

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -91,8 +91,9 @@ def get_ipv6_neighbors(duthost):
return ipv6_addresses


def test_bmp_population(duthosts, rand_one_dut_hostname, localhost):
duthost = duthosts[rand_one_dut_hostname]
def test_bmp_population(duthosts, enum_rand_one_per_hwsku_frontend_hostname, localhost,
enable_bmp_feature):
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]

# neighbor table - ipv4 neighbor
# only pick-up sent_cap attributes for typical check first.
Expand Down
4 changes: 3 additions & 1 deletion tests/bmp/test_docker_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
from tests.common.utilities import wait_until
from tests.common.helpers.assertions import pytest_assert

from bmp.helper import enable_bmp_feature

logger = logging.getLogger(__name__)

pytestmark = [
pytest.mark.topology('any')
]


def test_restart_bmp_docker(duthosts,
def test_restart_bmp_docker(duthosts, enable_bmp_feature,
Copy link
Copy Markdown
Contributor

@FengPan-Frank FengPan-Frank Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vivekverma-arista for making this fix, I've leave one comment on sonic-net/sonic-buildimage#21863 for further discussing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vivekverma-arista could you help to fix the flake8 failure?

enum_rand_one_per_hwsku_frontend_hostname):
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]

Expand Down
Loading