Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] support for configuring muxcable to manual mode of operation #1642

Merged
merged 9 commits into from
Jun 10, 2021

Conversation

vdahiya12
Copy link
Contributor

@vdahiya12 vdahiya12 commented May 27, 2021

Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

What I did

This PR adds support for an option to configure muxcable mode to a manual mode. The manual mode is in addition
to auto\active mode.

The new output would look like this in case an active flag is passed to the command line

admin@sonic:~$ sudo config muxcable mode manual Ethernet0

admin@sonic:~$ sudo config muxcable mode manual all

added an option to set muxcable mode to manual mode, in addition to existing auto/active modes.

How I did it

added the changes in config/muxcable.py and added testcases

How to verify it

Ran the unit tests

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 marked this pull request as draft May 27, 2021 04:35
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
config/muxcable.py Outdated Show resolved Hide resolved
config/muxcable.py Outdated Show resolved Hide resolved
config/muxcable.py Outdated Show resolved Hide resolved
config/muxcable.py Outdated Show resolved Hide resolved
config/muxcable.py Outdated Show resolved Hide resolved
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
jleveque
jleveque previously approved these changes Jun 1, 2021
@vdahiya12
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

config/muxcable.py Outdated Show resolved Hide resolved
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Jun 7, 2021

This pull request introduces 2 alerts when merging 4f943f9 into 25e17de - view on LGTM.com

new alerts:

  • 2 for Unused local variable

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@@ -74,7 +74,8 @@ def lookup_statedb_and_update_configdb(per_npu_statedb, config_db, port, state_c

state = get_value_for_key_in_dict(muxcable_statedb_dict, port, "state", "MUX_CABLE_TABLE")
if state_cfg_val is not configdb_state:
config_db.set_entry("MUX_CABLE", port, {"state": state_cfg_val})
config_db.set_entry("MUX_CABLE", port, {"state": "active",
Copy link
Contributor

@tahmed-dev tahmed-dev Jun 7, 2021

Choose a reason for hiding this comment

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

we can fix the lgtm by deleting the ipv4_value and ip64_value.

Copy link
Contributor

Choose a reason for hiding this comment

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

also, we are setting the entry to active instead of state_cfg_val.

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
port_status_dict[port] = 'OK'
else:
if str(state_cfg_val) == 'active' and str(state) != 'active':
config_db.set_entry("MUX_CABLE", port, {"state": state_cfg_val,
Copy link
Contributor

Choose a reason for hiding this comment

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

the config_db.set_entry should be outside the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 merged commit a425ca2 into sonic-net:master Jun 10, 2021
@vdahiya12 vdahiya12 deleted the manual_mode branch June 10, 2021 18:12
gitsabari pushed a commit to gitsabari/sonic-utilities that referenced this pull request Jun 15, 2021
…sonic-net#1642)

What I did
This PR adds support for an option to configure muxcable mode to a manual mode. The manual mode is in addition
to auto/active mode.

The new output would look like this in case an active flag is passed to the command line

admin@sonic:~$ sudo config muxcable mode manual Ethernet0

admin@sonic:~$ sudo config muxcable mode manual all

added an option to set muxcable mode to manual mode, in addition to existing auto/active modes.

How I did it
added the changes in config/muxcable.py and added testcases

How to verify it
Ran the unit tests

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
qiluo-msft pushed a commit that referenced this pull request Jun 16, 2021
…#1642)

What I did
This PR adds support for an option to configure muxcable mode to a manual mode. The manual mode is in addition
to auto/active mode.

The new output would look like this in case an active flag is passed to the command line

admin@sonic:~$ sudo config muxcable mode manual Ethernet0

admin@sonic:~$ sudo config muxcable mode manual all

added an option to set muxcable mode to manual mode, in addition to existing auto/active modes.

How I did it
added the changes in config/muxcable.py and added testcases

How to verify it
Ran the unit tests

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-utilities that referenced this pull request Aug 10, 2021
…sonic-net#1642)

What I did
This PR adds support for an option to configure muxcable mode to a manual mode. The manual mode is in addition
to auto/active mode.

The new output would look like this in case an active flag is passed to the command line

admin@sonic:~$ sudo config muxcable mode manual Ethernet0

admin@sonic:~$ sudo config muxcable mode manual all

added an option to set muxcable mode to manual mode, in addition to existing auto/active modes.

How I did it
added the changes in config/muxcable.py and added testcases

How to verify it
Ran the unit tests

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants