Skip to content

Implement more interfaces in dualtor_utils#2721

Merged
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:update_y_cable_utils
Jan 5, 2021
Merged

Implement more interfaces in dualtor_utils#2721
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:update_y_cable_utils

Conversation

@bingwang-ms
Copy link
Copy Markdown
Collaborator

Signed-off-by: bingwang [email protected]

Description of PR

Summary:
Fixes # (issue)
This PR add several new interfaces and fixtures in dualtor_utils.
Functions:

toggle_simulator_port_to_tor_a
toggle_simulator_port_to_tor_b
check_simulator_read_side

Fixtures:

toggle_all_simulator_ports_to_tor_a
toggle_all_simulator_ports_to_tor_b

The next plan is to toggle y_cable simulator ports with these newly implemented functions and fixtures.

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 add several new interfaces and fixtures in dualtor_utils.

How did you do it?

How did you verify/test it?

Verified by a demo script, which toggled all ports and verified returned status.

Any platform specific information?

No.

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

No.

Documentation

This PR add several new interfaces and fixtures in dualtor_utils.

Signed-off-by: bingwang <[email protected]>
@bingwang-ms bingwang-ms requested review from a team and wangxin December 31, 2020 10:14
Comment thread tests/common/dualtor/dualtor_utils.py Outdated
If physical_port is none, the returned url contains no '/port/action' (For polling/toggling all ports)
action: a str, output/drop or None. If action is None, the returned url contains no '/action'
Returns:
The url for posting flow update request, like http://10.0.0.64:8080/mux/vms17-8/1/drop(output)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the convention is to use "|" , for example "this|that", to indicate either "this" or "that". The example would be better like this:
http://10.0.0.64:8080/mux/vms17-8/1/drop|output

Comment thread tests/common/dualtor/dualtor_utils.py Outdated

Args:
server_url: a str, the full address of mux server, like http://10.0.0.64:8080/mux/vms17-8/1/drop(output)
server_url: a str, the full address of mux server, like http://10.0.0.64:8080/mux/vms17-8/[1/drop(output)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the convention is to use "|" , for example "this|that", to indicate either "this" or "that".

"""
server_url = _url(mux_server_url)
data = {"active_side": TOR_B}
pytest_assert(_post(server_url, data), "Failed to toggle all ports to TOR A")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this function is dependent on PR #2703.

The simulator server also supports two other options:

  • "toggle": Just toggle the active side for all ports
  • "random": Randomly set active side for each of the port.

Can you consider adding fixtures for these two options as well?

1. Add two new fixtures.
2. Update some comments.

Signed-off-by: bingwang <[email protected]>
@bingwang-ms
Copy link
Copy Markdown
Collaborator Author

All updated. Thanks for your great suggestions! @wangxin

Comment thread tests/common/dualtor/dualtor_utils.py Outdated
@pytest.fixture(scope='module')
def toggle_all_simulator_ports_to_random_side(mux_server_url):
"""
A module level fixture to toggle all ports to an random side.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

-> to a random side

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. Updated.

Copy link
Copy Markdown
Collaborator

@wangxin wangxin left a comment

Choose a reason for hiding this comment

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

LGTM except a typo in docstring.

Signed-off-by: bingwang <[email protected]>
@bingwang-ms bingwang-ms merged commit 1364ec2 into sonic-net:master Jan 5, 2021
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…net#14540)

Why I did it
src/linkmgrd

* 2b81c83 - (HEAD -> 202205, origin/202205) [active-standby] Enforce switchover based on heartbeats when mux probe keeps failing (sonic-net#184) (5 hours ago) [Jing Zhang]
src/sonic-platform-common

* c401866 - (HEAD -> 202205, origin/202205) Add set/get_lpmode APIs for sff8436 and sff8636 optics (sonic-net#353) (4 hours ago) [longhuan-cisco]
* ea8331e - implement CMIS set_laser_freq to support 100GHz grid space (sonic-net#294) (4 hours ago) [ChiouRung Haung]
src/sonic-platform-daemons

* cc32493 - (HEAD -> 202205, origin/202205) Retrieve subport from CONFIG_DB to enable breakout support (sonic-net#342) (4 hours ago) [mihirpat1]
* 864e589 - Pass grid parameter while calling set_laser_freq (sonic-net#317) (4 hours ago) [mihirpat1]
src/sonic-swss

* 699477d - (HEAD -> 202205, origin/202205) overlay_dmac change in Vnet configuration. (sonic-net#2721) (4 hours ago) [siqbal1986]
src/sonic-utilities

* f9f3e7e4 - (HEAD -> 202205, origin/202205) [voq] Add fabric_ns to the ns_list when display_option is DISPLAY_ALL. (sonic-net#2717) (4 hours ago) [jfeng-arista]
* eb2d9167 - [GCU] Prohibit removal of PFC_WD POLL_INTERVAL field (sonic-net#2777) (4 hours ago) [isabelmsft]
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.

2 participants