Skip to content

[dualtor] Implement fixtures for test setup#2899

Closed
bingwang-ms wants to merge 1 commit intosonic-net:masterfrom
bingwang-ms:dualtor_toggle_fixtures
Closed

[dualtor] Implement fixtures for test setup#2899
bingwang-ms wants to merge 1 commit intosonic-net:masterfrom
bingwang-ms:dualtor_toggle_fixtures

Conversation

@bingwang-ms
Copy link
Collaborator

Signed-off-by: bingwang [email protected]

Description of PR

Summary:
Fix #2834
This commit implements 4 new fixtures

  1. set_upper_tor_active (function level)
  2. set_lower_tor_active (function level)
  3. set_upper_tor_active_module (module level)
  4. set_lower_tor_active_module (module level)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

This PR is to implement several fixtures for dualtor test case setup.
For dualtor testcases, it's required to call one of these fixtures to ensure that the active ToR is expected.

How did you do it?

This PR implements 4 new fixtures.

How did you verify/test it?

Verified by a demo script


def test_demo_1(set_upper_tor_active):
    assert True

def test_demo_2(set_lower_tor_active):
    assert True

def test_demo_3(set_upper_tor_active_module):
    assert True

def test_demo_4(set_lower_tor_active_module):
    assert True

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

Dualtor specific.

Documentation

This commit implements 4 new fixtures

1 set_upper_tor_active (function level)
2 set_lower_tor_active (function level)
3 set_upper_tor_active_module (module level)
4 set_lower_tor_active_module (module level)

Signed-off-by: bingwang <[email protected]>
"""
A function level fixture to toggle mux to upper tor for all interfaces
"""
force_active_tor(upper_tor_host, "all")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the mux simulator to change the active ToR. Using the CLI commands should be reserved for the test cases that require manually changing the active ToR. Since the CLI commands are a feature that is being tested, we don't want to use them elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, we should use MUX simulator for toggle usecases. But, what is force_active_tor helper to be used for?
We should also make the fixtures in MUX simulator as function scope instead of module.

Copy link
Contributor

Choose a reason for hiding this comment

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

This also makes me ask why do we need this fixtures when we have similar task being done by fixtures present in mux_simulator_control.py?
toggle_all_simulator_ports_to_lower_tor()
toggle_all_simulator_ports_to_upper_tor()
.....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think using CLI is better than using the mux_simulator interfaces. Actually, the CLI will call mux_simulator at last. These fixtures are intended to be used before dualtor test cases that require a certain ToR as active.
In other word, I don't think we should call mux_simulator interfaces directly. Test cases should do what human do. So I think CLI is a better choice.

"""
A function level fixture to toggle mux to lower tor for all interfaces
"""
force_active_tor(lower_tor_host, "all")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. Will update.

"""
A module level fixture to toggle mux to upper tor for all interfaces
"""
force_active_tor(upper_tor_host, "all")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

"""
A module level fixture to toggle mux to lower tor for all interfaces
"""
force_active_tor(lower_tor_host, "all") No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, plus add newline to EOF

@bingwang-ms
Copy link
Collaborator Author

The PR is no longer needed as we already have toggle_all_simulator_ports_to_lower_tor() and toggle_all_simulator_ports_to_upper_tor() in mux_simulator_control.py. So close.

@bingwang-ms bingwang-ms closed this Feb 2, 2021
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…atically (sonic-net#15835)

src/sonic-utilities

* bc7c7929 - (HEAD -> 202205, origin/202205) Add FEC correctable and uncorrectable port stats (sonic-net#2027) (10 hours ago) [Prince George]
* 58db48ad - [show][muxcable] update `show mux tunnel-route` to check soc_ipv6 as well (10 hours ago) [Jing Zhang]
* 24fc1db8 - [dualtor][route_check] filter out `soc_ipv6`  (sonic-net#2899) (10 hours ago) [Jing Zhang]
* d89d4832 - [route_check][dualtor] Ignore vlan neighbor route miss (sonic-net#2888) (10 hours ago) [Longxiang Lyu]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Setup Fixtures

4 participants