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

[broadcom] Add broadcom ASIC info to "show version" click command #3621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wdoekes
Copy link

@wdoekes wdoekes commented Nov 19, 2024

What I did

When the ASIC platform is broadcom, expand the "show version" output with additional versions. This helps keeping track of different versions when building/testing.

How I did it

Added _get_broadcom_info() function that calls 'bcmcmd' with 'bsv' and 'show unit'.

How to verify it

Run show version on a device with broadcom ASIC and observe how it now lists this:

 # show version

 SONiC Software Version: SONiC.master.0-123456789
 SONiC OS Version: 12
 Distribution: Debian 12.8
 Kernel: 6.1.0-22-2-amd64
 Build commit: 123456789
 Build date: Tue Nov 12 15:28:30 UTC 2024
 Built by: sonic-builder

 Platform: x86_64-accton_as9716_32d-r0
 HwSKU: Accton-AS9716-32D
 ASIC: broadcom
 ASIC Count: 1
+ASIC API BRCM SAI ver: [10.1.42.0]
+ASIC API OCP SAI ver: [1.13.2]
+ASIC API SDK ver: [sdk-6.5.29]
+ASIC Model: Unit 0 chip BCM56980_B0 (current)
 Serial Number: ...

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

(see diff above)

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

(see diff above)

Additional comments

I am aware that:

  1. This is broadcom specific. I find it useful. Especially since the trouble I've been having with different versions working/not-working depending on libsaibcm.
  2. The code might not be in the best location. I'll gladly move parts to a submodule/helper file. Please give me feedback on where you'd rather see it.
  3. If syncd is down, the show version command takes slightly longer because of the timeouts. I think this is acceptable.

In my case, I could not get master from November 2024 to run on the Accton-AS7326-56X or Accton-AS9716-32D, except when I reverted ffb9bc021 and 433d039a4; reverting the BRCM SAI/SDK versions. While the BRCM/SAI versions will not get fetched if syncd is down (they will be in syslog), these clues are helpful when comparing output.

Another output:

 # show version

 SONiC Software Version: SONiC.202405.0-123456789
 SONiC OS Version: 12
 Distribution: Debian 12.8
 Kernel: 6.1.0-22-2-amd64
 Build commit: 123456789
 Build date: Mon Nov 18 15:56:07 UTC 2024
 Built by: sonic-builder

 Platform: x86_64-accton_as7326_56x-r0
 HwSKU: Accton-AS7326-56X
 ASIC: broadcom
 ASIC Count: 1
+ASIC API BRCM SAI ver: [11.2.13.1]
+ASIC API OCP SAI ver: [1.14.0]
+ASIC API SDK ver: [sdk-6.5.30-SP4]
+ASIC API CANCUN ver: [06.04.01]
+ASIC Model: Unit 0 chip BCM56873_A0 (current)
 Serial Number: ...

==== What I did

When the ASIC platform is broadcom, expand the "show version" output
with additional versions. This helps keeping track of different
versions when building/testing.

==== How I did it

Added _get_broadcom_info() function that calls 'bcmcmd' with 'bsv' and
'show unit'.

==== How to verify it

Run "show version" on a device with broadcom ASIC and observe how it now
lists this:

     # show version

     SONiC Software Version: SONiC.master.0-123456789
     SONiC OS Version: 12
     Distribution: Debian 12.8
     Kernel: 6.1.0-22-2-amd64
     Build commit: 123456789
     Build date: Tue Nov 12 15:28:30 UTC 2024
     Built by: sonic-builder

     Platform: x86_64-accton_as9716_32d-r0
     HwSKU: Accton-AS9716-32D
     ASIC: broadcom
     ASIC Count: 1
    +ASIC API BRCM SAI ver: [10.1.42.0]
    +ASIC API OCP SAI ver: [1.13.2]
    +ASIC API SDK ver: [sdk-6.5.29]
    +ASIC Model: Unit 0 chip BCM56980_B0 (current)
     Serial Number: ...

On other platforms, that info will not be added. On any regular failure
(command not found, permission denied, command rejected, unexpected
output), show version will still complete.
@wdoekes wdoekes force-pushed the show-version-add-broadcom-info branch from 8ef76b9 to 6d90f4d Compare November 19, 2024 18:36
@@ -1496,6 +1508,8 @@ def version(verbose):
click.echo("HwSKU: {}".format(platform_info['hwsku']))
click.echo("ASIC: {}".format(platform_info['asic_type']))
click.echo("ASIC Count: {}".format(platform_info['asic_count']))
if asic_info:
Copy link
Contributor

Choose a reason for hiding this comment

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

would this be disruptive for some test cases if adding output in the middle of show version cli?

Copy link
Author

Choose a reason for hiding this comment

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

Legit question.

If I look at tests/show_platform_test.py, it should not change (for now) because it has a mellanox ASIC_TYPE and not a broadcom one.

My reason for placing it in the middle was this: the top info can then be copy-pasted into bug reports without including machine-specific serial numbers.

If you want, I can add a test there for the broadcom model with this output included.

Copy link
Author

Choose a reason for hiding this comment

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

B.t.w. I'd rather fetch the info once at initialization from the ASIC and get it from a state(?) db during show version, but that's probably more invasive.

Copy link
Contributor

Choose a reason for hiding this comment

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

my thought is better to keep output backward compatibility, since we are not sure if there's other customize scripts would be broken.

Copy link
Author

Choose a reason for hiding this comment

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

Ok ok.

So, after the second paragraph and before the docker image list then?

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