Skip to content

Commit

Permalink
Fix test case: generic_config_updater/test_ipv6.py::test_ipv6_neighbo…
Browse files Browse the repository at this point in the history
…r_admin_change (#5647)

This case fails every time on our testbeds because it tries to replace the admin_status value of a bgp neighour, while the admin_status field doesn't exist in the default running configuration generated from minigraph(the admin_status is up without a explicit "admin_status": "up" config in db).
To fix this, need to add this config before replace it.
And add a topology mark for the test according to the description in [GCU] Add config ipv6 BGP neighbor test #5061 .

- What is the motivation for this PR?
Ensure that the configuration exists in the running config before it is replaced by the patch .
Add a topology mark for the test to ensure it runs with the correct topologies. According to the description in [GCU] Add config ipv6 BGP neighbor test #5061, this test support t0 and t1 testbeds.

- How did you do it?
Modified the patch to add this config before replace it. If the config already exists before the adding, it won't take any effects because the config is duplicated.
Add the topology mark.

- How did you verify/test it?
Run this test case on testbeds with and without the admin_status field in running configs, all passed.
  • Loading branch information
congh-nvidia authored May 19, 2022
1 parent f40a5ce commit e5a04cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/generic_config_updater/test_ipv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

logger = logging.getLogger(__name__)

pytestmark = [
pytest.mark.topology('t0', 't1'),
]

@pytest.fixture(autouse=True)
def ensure_dut_readiness(duthost):
Expand Down Expand Up @@ -153,6 +156,11 @@ def test_invalid_ipv6_neighbor(duthost, ensure_dut_readiness, op, dummy_neighbor
def test_ipv6_neighbor_admin_change(duthost):
ipv6_neighbor_address, ipv6_neighbor_config = get_ipv6_neighbor(duthost)
json_patch = [
{
"op": "add",
"path": "/BGP_NEIGHBOR/{}/admin_status".format(ipv6_neighbor_address),
"value": "up"
},
{
"op": "replace",
"path": "/BGP_NEIGHBOR/{}/admin_status".format(ipv6_neighbor_address),
Expand Down

0 comments on commit e5a04cb

Please sign in to comment.