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

[show][config] cli support for firmware upgrade on Y-Cable #1528

Merged
merged 13 commits into from
Apr 5, 2021

Conversation

vdahiya12
Copy link
Contributor

@vdahiya12 vdahiya12 commented Mar 26, 2021

Summary:
This PR provides the support for adding CLI commands for activatie, download, upgrade firmware on the Y-cable
In particular these Cli commands are supported:
sudo config muxcable firmware download Ethernet0
sudo config muxcable firmware rollback Ethernet0
sudo config muxcable firmware download ~/AEC_WYOMING_B52Yb0_MS_0.6_20201218.bin Ethernet0

Signed-off-by: vaibhav-dahiya [email protected]

What I did

Added the support for firmware upgrade CLI on Y cable

How I did it

added the changes in sonic-utilities/show and sonic-utilities/config by changing the muxcable.py

admin@STR43-0101-0101-01LT0:/usr$ sudo config muxcable firmware download ~/AEC_WYOMING_B52Yb0_MS_0.6_20201218.bin Ethernet0
firmware download successful Ethernet0

admin@STR43-0101-0101-01LT0:~/credo_script_01_21$ sudo config muxcable firmware activate Ethernet0
firmware activate successful Ethernet0

admin@STR43-0101-0101-01LT0:~/credo_script_01_21$ sudo config muxcable firmware rollback Ethernet0
firmware rollback successful Ethernet0

How to verify it

Ran the command on a 7050cx3 arista switch

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)

@vdahiya12 vdahiya12 marked this pull request as draft March 26, 2021 14:18
@lgtm-com
Copy link

lgtm-com bot commented Mar 26, 2021

This pull request introduces 1 alert when merging 233f238 into 1f1696a - view on LGTM.com

new alerts:

  • 1 for Syntax error

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 26, 2021

This pull request introduces 3 alerts when merging b44a442 into 1f1696a - view on LGTM.com

new alerts:

  • 3 for Unused local variable

Signed-off-by: vaibhav-dahiya <[email protected]>
@vdahiya12 vdahiya12 requested a review from jleveque March 26, 2021 16:53
@vdahiya12 vdahiya12 marked this pull request as ready for review March 26, 2021 16:54
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

There is a lot of duplicate code in these new functions. Can you look into writing a helper function(s) so as to share common code?

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 29, 2021

This pull request introduces 1 alert when merging 63c6977 into 6b51bcd - view on LGTM.com

new alerts:

  • 1 for Syntax error

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 29, 2021

This pull request introduces 1 alert when merging d04d25a into 6b51bcd - view on LGTM.com

new alerts:

  • 1 for Syntax error

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 29, 2021

This pull request introduces 1 alert when merging a81c943 into 6b51bcd - view on LGTM.com

new alerts:

  • 1 for Syntax error

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 29, 2021

This pull request introduces 1 alert when merging e12a491 into 6b51bcd - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Signed-off-by: vaibhav-dahiya <[email protected]>
@vdahiya12 vdahiya12 changed the title [config] cli support for firmware upgrade on Y-Cable [show][config] cli support for firmware upgrade on Y-Cable Mar 30, 2021
@vdahiya12 vdahiya12 added the show label Mar 30, 2021
Comment on lines 766 to 769
if rc:
sys.exit(CONFIG_SUCCESSFUL)
else:
sys.exit(CONFIG_FAIL)
Copy link
Contributor

Choose a reason for hiding this comment

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

rc seems redundant as a bool. Suggest setting rc = CONFIG_SUCCESSFUL on line 750, rc = CONFIG_FAIL on line 764, and here simply call sys.exit(rc).

Suggest making this change throughout the file.

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 <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Mar 30, 2021

This pull request introduces 1 alert when merging 52ece4b into 6b51bcd - view on LGTM.com

new alerts:

  • 1 for Syntax error

Signed-off-by: vaibhav-dahiya <[email protected]>
show/muxcable.py Outdated
@@ -820,3 +820,196 @@ def switchmode(port):
click.echo(tabulate(body, headers=headers))
if rc == False:
sys.exit(EXIT_FAIL)


def create_result_dict(physical_port, mux_info_dict, result_dict):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jleveque should we move all this to y_cable.py or let it remain here ?
this is in regards to the newer resultant dict you suggested.
For example ?
{
"version_nic_active": "0.6MS",
"version_nic_inactive": "0.5MS",
"version_nic_next": "0.6MS",
"version_self_active": "0.5MS",
"version_self_inactive": "0.6MS",
"version_self_next": "0.6MS",
"version_peer_active": "0.6MS",
"version_peer_inactive": "0.6MS",
"version_peer_next": "0.6MS",
}

Copy link
Contributor

@jleveque jleveque Mar 30, 2021

Choose a reason for hiding this comment

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

In y_cable.py the function to get firmware from a end should return active, inactive and next values. I would think here we would call it for each end to gather the firmware versions for all ends that we can.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored, new API's used here

Signed-off-by: vaibhav-dahiya <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Apr 4, 2021

This pull request introduces 1 alert when merging f1c1550 into 9bbc25f - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Signed-off-by: vaibhav-dahiya <[email protected]>
config/muxcable.py Outdated Show resolved Hide resolved
Signed-off-by: vaibhav-dahiya <[email protected]>
@yxieca
Copy link
Contributor

yxieca commented Apr 8, 2021

@vdahiya12 this change cannot be cherry-picked to 202012 branch cleanly. Can you find the dependent PR or create separate PR with this change for 202012 branch?

vdahiya12 added a commit to vdahiya12/sonic-utilities that referenced this pull request Apr 12, 2021
…#1528)

Summary:
This PR provides the support for adding CLI commands for activatie, download, upgrade firmware on the Y-cable
In particular these Cli commands are supported:
sudo config muxcable firmware download Ethernet0
sudo config muxcable firmware rollback Ethernet0
sudo config muxcable firmware download ~/AEC_WYOMING_B52Yb0_MS_0.6_20201218.bin Ethernet0

Signed-off-by: vaibhav-dahiya [email protected]

What I did
Added the support for firmware upgrade CLI on Y cable

How I did it
added the changes in sonic-utilities/show and sonic-utilities/config by changing the muxcable.py

Signed-off-by: vaibhav-dahiya <[email protected]>
@vdahiya12
Copy link
Contributor Author

opened a PR for 202012 branch
#1558

vdahiya12 added a commit that referenced this pull request Apr 15, 2021
…1558)

* [show][config] cli support for firmware upgrade on Y-Cable (#1528)

Summary:
This PR provides the support for adding CLI commands for activatie, download, upgrade firmware on the Y-cable
In particular these Cli commands are supported:
sudo config muxcable firmware download Ethernet0
sudo config muxcable firmware rollback Ethernet0
sudo config muxcable firmware download ~/AEC_WYOMING_B52Yb0_MS_0.6_20201218.bin Ethernet0

Signed-off-by: vaibhav-dahiya [email protected]

What I did
Added the support for firmware upgrade CLI on Y cable

How I did it
added the changes in sonic-utilities/show and sonic-utilities/config by changing the muxcable.py

Signed-off-by: vaibhav-dahiya <[email protected]>
gitsabari pushed a commit to gitsabari/sonic-utilities that referenced this pull request Jun 15, 2021
…#1528)


Summary:
This PR provides the support for adding CLI commands for activatie, download, upgrade firmware on the Y-cable
In particular these Cli commands are supported:
sudo config muxcable firmware download Ethernet0
sudo config muxcable firmware rollback Ethernet0
sudo config muxcable firmware download ~/AEC_WYOMING_B52Yb0_MS_0.6_20201218.bin Ethernet0

Signed-off-by: vaibhav-dahiya [email protected]

What I did
Added the support for firmware upgrade CLI on Y cable

How I did it
added the changes in sonic-utilities/show and sonic-utilities/config by changing the muxcable.py

Signed-off-by: vaibhav-dahiya <[email protected]>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
 Support ACL Table type Mirrorv6 for Innovium (sonic-net#1528)
Enable v6 ACL rule based Mirroring for Innovium Platform

Signed-off-by: Abhishek Dosi <[email protected]>
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.

3 participants